It's all about the answers!

Ask a question

How can I create via API in DNG a delivery session?


Antje Rößle-Tuchel (294) | asked Oct 24 '23, 4:34 a.m.

 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


permanent link
Ralph Schoon (63.3k33646) | answered Oct 24 '23, 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

The DNG Server API contains an API for delivery sessions.

Antje Rößle-Tuchel selected this answer as the correct answer

Comments
Antje Rößle-Tuchel commented Oct 25 '23, 5:09 a.m.
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



permanent link
Antje Rößle-Tuchel (294) | answered Oct 25 '23, 5:09 a.m.

 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: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:creation rdf:resource="http://open-services.net/ns/core#CreationFactory" />
                    <oslc:deliverySession rdf:resource="http://jazz.net/ns/rm/dng/config#DeliverySession">
                        <oslc:resourceShape rdf:about="http://open-services.net/ns/core#resourceShape">
                            <dng_config:source rdf:resource="https://mpt-ialm.magna.global/rm/cm/changeset/"{changesetUri}/>
                            <dng_config:target rdf:resource="https://mpt-ialm.magna.global/rm/cm/stream/"{streamUri}/>
                        </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
Ralph Schoon commented Oct 25 '23, 5:42 a.m. | edited Oct 25 '23, 5:46 a.m.
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 .


Ralph Schoon commented Oct 25 '23, 6:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Antje Rößle-Tuchel commented Oct 25 '23, 8:03 a.m.

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 


permanent link
Antje Rößle-Tuchel (294) | answered Oct 27 '23, 5:25 a.m.

 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/"
    <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
Ralph Schoon commented Oct 27 '23, 7:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What does "it does not work" mean? Can you do it in the UI? 


Ian Barnard commented Oct 30 '23, 4:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

AFAIK the delivery API only supports delivery of changesets into the stream they are created in. 


Ralph Schoon commented Nov 13 '23, 7:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

PS: consider creating a new question for the ChangeSet API. 


permanent link
Antje Rößle-Tuchel (294) | answered Nov 06 '23, 9:00 a.m.

 I think I have got one more information: I can create a new delivery session on a different stream (use for the target the streamUri of the different stream). But only if the change set was not delivered before on the origin stream. But on the UI I can deliver the change set more than one time and to different streams.


If I try to create a new delivery session on a different stream and set as target the streamUri of the different stream - on the UI the changeset is created on the same stream as the changeset was created...

So I have two questions: 
can I deliver change sets via the API more than one time?
how can I create change sets on another stream if the target does not work?


Comments
Ralph Schoon commented Nov 06 '23, 10:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can look here: com.ibm.rm.typemanagement/src/main/java/com/ibm/requirement/typemanagement/oslc/client/resources/Changeset.java 


Unfortunately there is no documentation. If you create the change set it is important that you have to provide an arbitrary URI. It gets replaced when creating the change set, but if you leave it null, the creation fails.


This is the information a change set has: 

  private String title;
private String description;
private URI component;
private URI stream;
private URI type;


Ralph Schoon commented Nov 06 '23, 10:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 You pass the target configuration when you create the change set: 


public Changeset(final JazzFormAuthClient client, final String title, final String description,
final Configuration target) throws IOException, OAuthException, URISyntaxException {
super(null);
create(client, title, description, target);
}


permanent link
hom fix (11) | answered Nov 07 '23, 1:42 a.m.
edited Nov 07 '23, 3:02 a.m. by Ralph Schoon (63.3k33646)

 POST https://nowhere.nix/

OSLC-Core-Version: 2.0
Accept: application/rdf+xml
Content-Type: application/rdf+xml
Configuration-Context: [change-Set-Uri]


Comments
Antje Rößle-Tuchel commented Nov 10 '23, 4:38 a.m.

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)


 


permanent link
Antje Rößle-Tuchel (294) | answered Nov 10 '23, 4:38 a.m.
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:oslc_config="http://open-services.net/ns/config#"
    xmlns:process="http://jazz.net/ns/process#">
    <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]"/>
      <acc:accessContext rdf:resource="https://mpt-ialm.magna.global/rm/acclist#_[project-URL"/>
      <oslc_config:acceptedBy rdf:resource="http://open-services.net/ns/config#Configuration"/>
      <rdf:type rdf:resource="http://open-services.net/ns/config#Configuration"/>
      <rdf:type rdf:resource="http://open-services.net/ns/config#ChangeSet"/>
      <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


permanent link
Antje Rößle-Tuchel (294) | answered Nov 10 '23, 4:40 a.m.
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:oslc_config="http://open-services.net/ns/config#"
    xmlns:process="http://jazz.net/ns/process#">
    <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]"/>
      <acc:accessContext rdf:resource="https://mpt-ialm.magna.global/rm/acclist#_[project-URL"/>
      <oslc_config:acceptedBy rdf:resource="http://open-services.net/ns/config#Configuration"/>
      <rdf:type rdf:resource="http://open-services.net/ns/config#Configuration"/>
      <rdf:type rdf:resource="http://open-services.net/ns/config#ChangeSet"/>
      <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


permanent link
Ralph Schoon (63.3k33646) | answered Nov 10 '23, 5:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 10 '23, 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
Antje Rößle-Tuchel commented Nov 13 '23, 6:58 a.m.
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


Ralph Schoon commented Nov 13 '23, 7:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.  


Ralph Schoon commented Nov 13 '23, 7:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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; 


Status code in my case was 202. You comment above fails to provide anything useful e.g. what you got back with the 200. It could be an HTML page that tells you you are not logged in or something.



permanent link
Antje Rößle-Tuchel (294) | answered Nov 13 '23, 6:59 a.m.

 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/"
    <j.0:Configuration rdf:about="http://open-services.net/ns/config#Changeset">
      <dcterms:title rdf:parseType="Literal">Change Set created from API</dcterms:title>
      <j.0:stream rdf:resource="[streamUri]"/>
      <j.0:component rdf:resource="[componentUri]"/>
      <rdf:type rdf:resource="http://open-services.net/ns/config#Changeset"/>
  </j.0:Configuration>
</rdf:RDF>


Comments
Antje Rößle-Tuchel commented Nov 13 '23, 7:11 a.m.

see new question for creating change sets: How can I create in DNG via API a new change set? - Jazz Forum 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.