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

How can I create in DNG via API a new change set?

I want to create a new change set in DNG via a HTTP Request:

 
My last trial looks like that: 

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>

As response I get "200 OK" but not a "201 Created" and no task tracker or changeSetUri.

What is missing in my request?

0 votes


Accepted answer

Permanent link

You need to post to the changesets URI of the stream.


Follow discovery like this https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area/266667 - i.e. DO NOT construct any URL other than /rm/rootservices

Follow that flow, and below "To details of the config" with this example RDF for the stream:
<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:j.0="http://jazz.net/ns/rm/dng/config#"
    xmlns:acc="http://open-services.net/ns/core/acc#"
    xmlns:process="http://jazz.net/ns/process#">
  <oslc_config:Configuration rdf:about="https://jazz.ibm.com:9443/rm/cm/stream/_9JKJULTCEemWdOARsjdAvg">
    <oslc_config:baselines rdf:resource="https://jazz.ibm.com:9443/rm/cm/stream/_9JKJULTCEemWdOARsjdAvg/baselines"/>
    <oslc_config:previousBaseline rdf:resource="https://jazz.ibm.com:9443/rm/cm/baseline/_hWs5sNfaEemPJeiVEDPvog"/>
    <oslc_config:acceptedBy rdf:resource="http://open-services.net/ns/config#Configuration"/>
    <dcterms:description></dcterms:description>
    <dcterms:identifier>_9JKJULTCEemWdOARsjdAvg</dcterms:identifier>
    <oslc_config:component rdf:resource="https://jazz.ibm.com:9443/rm/cm/component/_9I2ngrTCEemWdOARsjdAvg"/>
    <dcterms:title rdf:parseType="Literal">rm_gc_p1 Initial Stream</dcterms:title>
    <oslc:serviceProvider rdf:resource="https://jazz.ibm.com:9443/rm/oslc_rm/_9EtHILTCEemWdOARsjdAvg/services.xml"/>
    <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
    >2019-08-02T01:15:03.156Z</dcterms:created>
    <rdf:type rdf:resource="http://open-services.net/ns/config#Stream"/>
    <j.0:changesets rdf:resource="https://jazz.ibm.com:9443/rm/cm/stream/_9JKJULTCEemWdOARsjdAvg/changesets"/>
    <oslc_config:selections rdf:resource="https://jazz.ibm.com:9443/rm/configSelections/stream/_9JKJULTCEemWdOARsjdAvg"/>
    <acc:accessContext rdf:resource="https://jazz.ibm.com:9443/rm/acclist#_9EtHILTCEemWdOARsjdAvg"/>
    <process:projectArea rdf:resource="https://jazz.ibm.com:9443/rm/process/project-areas/_9EtHILTCEemWdOARsjdAvg"/>
    <dcterms:creator rdf:resource="https://jazz.ibm.com:9443/jts/users/ibm"/>
  </oslc_config:Configuration>
</rdf:RDF>
 
You see the changesets URL for this stream in     <j.0:changesets rdf:resource="https://jazz.ibm.com:9443/rm/cm/stream/_9JKJULTCEemWdOARsjdAvg/changesets"/>

POST to this with headers:
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Content-type: application/rdf+xml
Configuration-Context: stream-URI

Minimal XML is like this:

<rdf:RDF
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc_config="http://open-services.net/ns/config#">
      <oslc_config:Configuration rdf:about="https://jazz.ibm.com:9443/rm/cm/changeset/something">
        <dcterms:title rdf:parseType="Literal">Title of the Changeset</dcterms:title>
        <dcterms:description rdf:parseType="Literal">Some Description of Changeset</dcterms:description>      
        <oslc_config:component rdf:resource="https://jazz.ibm.com:9443/rm/cm/component/_4KRMENcKEeqXpuBdEolY7w"/>
      </oslc_config:Configuration>
</rdf:RDF>

NOTE the "something" rdf:about URI in tag oslc_config:component has to be present as a dummy URL, all URLs need adapting to your SERVER:PORT, the oslc_config:component must be your component URL

Success response is 202 with header Location pointing at the task tracker.

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

0 votes

Comments

 Thank you very much! This work. I get a 202 accepted and a task tracker as respond.  

How can I get resources in the change set? 


Background: I need to deliver one change set several times. So I need to derive a change set from another to be able to deliver it via delivery sessions. Therefore I think I need to get a wasDerivedFrom link to the orginal change set and additionally the changed resources "copied" from the original change set in the new one created. Is this possible and how?

Technically speaking a changeset configuration references all the resources in the stream, i.e. not just changed resources. And once delivered the changeset doesn't exist any more, or at least it isn't visible if you use the APIs to find changesets.

I don't know the answer to your question but I've never heard of the need to derive a new changes set to deliver again. Maybe using the changeset URL which you've already got you can use that (again) as the source configuration to deliver to a different target stream (in the same component, of course) than the stream the changeset was created in/from? If that doesn't work then what you're asking for probably isn't possible today.

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,937

Question asked: Nov 13 '23, 7:10 a.m.

Question was seen: 746 times

Last updated: Dec 06 '23, 7:12 a.m.

Confirmation Cancel Confirm