How to Create Requirements in other Components than the Default Component
Hi,
I am only succeeded in creating requirements in folders located in one (default?) of three components of the project I am working in. I am not able to direct the POST requirement factory message to operate on the two other components.
How can I direct the creation of requirements to folders (and modules) located in a component of my choice?
Regards Magnus
Accepted answer
Hi Magnus
You need to include a header Configuration-Context with your POST, with the URI of a configuration in the component you want to create the requirement it
HTH
Ian
Comments
Hi Ian,
and thanks for your answer!
I have tried as you suggested, and also, read your answer in "https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area" and found the URI of the configuration of my non-default Component and accordingly added:
httpWebRequest.Headers.Add("Configuration-Context", "https://.../rm/configSelections/stream/_m7mO8HUeEeuc2f2NAwVSqg")
to my POST
However, the request responds with: "(400) Bad Request"
If I remove the header above, the POST results in the creation of a new requirement in the default component.
Have I found a faulty URI?
Regards
Magnus
To get things working you can always manually get the configuration URL from a 'Share link to artifact' of an artifact in the component+configuration you want to create in.
Please confirm your configuration URL is valid, i.e. with a HOST:PORT i.e. not literally starting with https://.../ ?
Maybe try header oslc_config.context instead of Configuration-Context.
My starting point for getting these operations to work is to start by using a REST client in a browser, then once it's working ensure code sends precisely the same pattern of content/header to the same URL.
The URL form is in the format https://x.x.x.x/gc/configuration/48 and the oslc_config.context does not work.
"Share link to artifact" for a artefact in a non-default component is:
However, I just noted that when I export requirements from DNG to excel I receive the following meta data:
Default Component:
Export Project Area=https://x.x.x.x/rm/rm-projects/_u9BacHJ7EeuYaNFaR904Vg/components/_vbL9IHJ7EeuYaNFaR904Vg
Export Configuration=https://x.x.x.x/gc/configuration/48
Non-default Component:
Export Project Area=https://x.x.x.x/rm/rm-projects/_u9BacHJ7EeuYaNFaR904Vg/components/_m7ZaoHUeEeuc2f2NAwVSqg
Export Configuration=https://x.x.x.x/gc/configuration/48
What version+iFix are you using? This definitely works - like I say, to reduce the variables (each being a possibility for it not working), try doing this POST using a REST client in your browser.
You probably aren't posting to the creation factory for the component - you have to use the local configuration to retrieve the factory URLs, as (I think) described in that other post of mine you mentioned. In fact you may have to use the local configuration URL to do the POST, not sure.
Refer to my other post https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area
At the part starting "Accessing the services.xml without a configuration will give you the details for the default component." ...
read on, how to get the factory URLs for the component using the local config.
Hi,
now it is working !
It start to work when I added the header, see below, holding the URI to the non-default component stream, along with my initial queries (OSLC API GET) in order to acquire the capabilities for Query, FolderQuery and CreationFactory.
httpWebRequest.Headers.Add("Configuration-Context", "https://x.x.x.x/rm/cm/stream/_m7mO8HUeEeuc2f2NAwVSqg")
Furthermore, I added the same header to my POST when creating the new requirement.
Note, if I remove the header in my initial GET, the URI to the capabilities remained the same, though the following POST failed with "(400) Bad Request".
Regards Magnus