How can I create via API in DNG a delivery session?
![]() I want to create in JavaScript a delivery session for DNG. How must be the post-fetch body look like? Is there an example for this? |
Accepted answer
![]()
Ralph Schoon (62.7k●3●36●43)
| answered Oct 24, 6:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER This is the API landing page for all applications: https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding Antje Rößle-Tuchel selected this answer as the correct answer
Comments
Dear Ralph,
thank you very much. The comment gives less characters for my comment so please read my answer and give me a short feedback.
Thank you very much
Antje
|
8 other answers
![]() Dear Ralph,
thank you very much for the links. I am really a beginner and tried hard but landing always in the Response 405 Method not allowed.
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
Content-Type: application/rdf+xml
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:oslc_cm="http://open-services.net/ns/cm#"
xmlns:dng_config="https://jazz.net/ns/rm/dng/config#"
<oslc:service>
<oslc:Service>
<oslc:creationFactory>
<oslc:CreationFactory>
</oslc:resourceShape>
</oslc:deliverySession>
</oslc:CreationFactory>
</oslc:creationFactory>
</slc:Service>
</oslc:service>
</rdf:RDF>
Could you please give me a short feedback, if I am completely on the wrong way or what my mistakes are?
Thank you very much in advance.
Antje
Comments ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Antje,
API questions are very expensive to answer. I am not able to spend the amount of time needed, to test this at the moment.
I have published source code, that uses Eclipse Lyo to do stuff on the DNG type system, including a delivery session. You can find the references, including code here: https://rsjazz.wordpress.com/2019/03/07/type-system-manager-part-2/ . I have also provided some examples in the article https://jazz.net/library/article/92596 .
Dependent on your environment, please also see https://jazz.net/forum/questions/98072/x-jazz-csrf-prevent-header-is-required-to-create-a-work-item-via-oslc-on-version-4001/98073 Dear Ralph,
than you so much for the link to your article. With this example I just have created a new delivery session via a POST request.
Best regards,
Antje
|
![]() I can now create and deliver a new delivery session. This works, if the original change set is on the stream created, on which it has to be delivered. My request looks like this:
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
Content-Type: application/rdf+xml
Configuration-Context: [change-Set-Uri]
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
<j.0:DngCmDeliverySession>
<oslc:serviceProvider rdf:resource="[path]/rm/oslc_rm/[project_uri]/services.xml"/>
<dcterms:title rdf:parseType="Literal">Composite Delivery per API</dcterms:title>
<j.0:source rdf:resource="[change-Set-Uri]"/>
<j.0:target rdf:resource="[stream-Uri-of-target-stream]"/>
<j.0:DngCmDeliveryPolicy>
<j.0:dominantSourceAttribute rdf:resource="[attribute-uri-of-target-stream]"/>
</j.0:DngCmDeliveryPolicy>
</j.0:DngCmDeliverySession>
</rdf:RDF>
But if I want to deliver the same change Set to another stream, it does not work. Is there anybody you can help me by solving this?
Thank you in advance
Comments What does "it does not work" mean? Can you do it in the UI? AFAIK the delivery API only supports delivery of changesets into the stream they are created in. PS: consider creating a new question for the ChangeSet API. |
![]() POST https://nowhere.nix/
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
Content-Type: application/rdf+xml
Configuration-Context: [change-Set-Uri]
Comments Thank you Ralph for your answer and help. Can you please provide me the full link to com.ibm.rm.typemanagement/src/main/java/com/ibm/requirement/typemanagement/oslc/client/resources/Changeset.java? I am struggling in open it.
What I have tried until know: (see answer)
|
![]()
My last trials:
###
POST [https://URL]
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Content-type: application/rdf+xml
Configuration-Context: [some change-set-URL]
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:acc="http://open-services.net/ns/core/acc#"
<oslc_config:Stream rdf:about="[some change-set-URL]">
<oslc:serviceProvider rdf:resource="[service-provider-URL]"/>
<dcterms:title rdf:parseType="Literal">Change Set created from API</dcterms:title>
<process:projectArea rdf:resource="[project-area-URL]"/>
<oslc_config:component rdf:resource="[component-URL]"/>
<oslc_config:stream rdf:resource="[stream-URL]"/>
<oslc_config:overrides rdf:resource="[stream-URL]"/>
<oslc_config:derivedFrom="[the origin change-set-URL"/>
</oslc_config:Stream>
</rdf:RDF>
I receive the answer: "HTTP/1.1 200 OK" and "Content-Length: 0": but with no change-set-URI in it? And no change set on the stream is created.
Can you please give me a hint, what I have to change?
Thank you in advance
|
![]()
My last trials:
###
POST [https://URL]
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Content-type: application/rdf+xml
Configuration-Context: [some change-set-URL]
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:acc="http://open-services.net/ns/core/acc#"
<oslc_config:Stream rdf:about="[some change-set-URL]">
<oslc:serviceProvider rdf:resource="[service-provider-URL]"/>
<dcterms:title rdf:parseType="Literal">Change Set created from API</dcterms:title>
<process:projectArea rdf:resource="[project-area-URL]"/>
<oslc_config:component rdf:resource="[component-URL]"/>
<oslc_config:stream rdf:resource="[stream-URL]"/>
<oslc_config:overrides rdf:resource="[stream-URL]"/>
<oslc_config:derivedFrom="[the origin change-set-URL"/>
</oslc_config:Stream>
</rdf:RDF>
I receive the answer: "HTTP/1.1 200 OK" and "Content-Length: 0": but with no change-set-URI in it? And no change set on the stream is created.
Can you please give me a hint, what I have to change?
Thank you in advance
|
![]()
Ralph Schoon (62.7k●3●36●43)
| answered Nov 10, 5:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Nov 10, 5:16 a.m. See https://jazz.net/library/article/92596 how to get the code.
Look at the constructor of ChangeSet, you need a fake URI for the change set, the target configuration, and a title.
Also look into the createChangeSet method. Please note, that you do not get a change set URI back with the POST. You need to use a task tracker to monitor the creation status. Once the creation is finished, you get the change set URI back.
The task tracker API is documented with the DNG server APIs
See the method trackCreation.
Comments
Thank you for your answer.
I changed my request like (see answer). But it is always the same: I got nothing back: no tast tracker, no changeSetURI. The Answer is 200 OK, but not 201 Created. See my request in the your answer I can not remote debug your API calls. Consider using Firefox RESTClient extension to test your calls. Please note that the Task Tracker is sent in the LOCATION header. You will not get back a response body. This is how to get the task tracker URI: case 202:
trackerURI = response.getHeaders().getFirst(HttpHeaders.LOCATION);
if (trackerURI != null) {
logger.debug("Change set creation tracker URL is '{}'.", trackerURI);
}
return trackerURI;
|
![]() POST [URI]
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Content-type: application/rdf+xml
Configuration-Context: [stream-URI / change-set-URI: I've tried both, I can see no difference in the response]
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:j.0="http://open-services.net/ns/config#"
<dcterms:title rdf:parseType="Literal">Change Set created from API</dcterms:title>
<j.0:stream rdf:resource="[streamUri]"/>
<j.0:component rdf:resource="[componentUri]"/>
</j.0:Configuration>
</rdf:RDF>
Comments see new question for creating change sets: How can I create in DNG via API a new change set? - Jazz Forum |