Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Accepted answer

Permanent link

 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

0 votes

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

Permanent link

 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

0 votes

Comments

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 .

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

 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

0 votes

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. 


Permanent link

 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?

0 votes

Comments

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;

 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

 POST https://nowhere.nix/

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

0 votes

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)


 


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link

 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.

0 votes

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; 


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

 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>

0 votes

Comments

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,948

Question asked: Oct 24 '23, 4:34 a.m.

Question was seen: 1,815 times

Last updated: Nov 13 '23, 7:12 a.m.

Confirmation Cancel Confirm