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

PUT method in DNG to update artifact is not working

 Hi Team,


We are using DNG 7.0.2 SR1
We are trying to update DNG artifact from GC enabled project area by referring below document:

We are using below API:


Input Text:
<rdf:RDF
<oslc:serviceProvider rdf:resource="https://servername/rm/oslc_rm/Ou6HwCo7EeuYz8KHPSBUuA/services.xml"/>
<dcterms:contributor rdf:resource="https://servername/jts/users/username"/>
<rdf:type rdf:resource="http://jazz.net/ns/rm#Text"/>
<dcterms:title rdf:parseType="Literal">Introduction to DNG Utility</dcterms:title>
<dcterms:description rdf:parseType="Literal"></dcterms:description>
<dcterms:creator rdf:resource="https://servername/jts/users/WZ8838"/>
<jazz_rm:primaryText rdf:parseType="Literal">
<div
                xmlns="http://www.w3.org/1999/xhtml">
<p id="_1686744887948">Introduction</p>
</div>v
</jazz_rm:primaryText>
</rdf:Description>
</rdf:RDF>

Headers:
Content-Type: application/rdf+xml
If-Match: TX_VSp6VbgTEe21Q_607LRcZA
Etag: "%220%22&%22-egKwOpfEe205cHiX6_oiQ%26_-eb5UOpfEe205cHiX6_oiQ%22"

"Etag header is getting from GET method of same URL"

We are getting below error
412: Precondition failed
<rdf:RDF
    <rdf:Description>
        <err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >com.ibm.rdm.fronting.server.exception.PreconditionFailedException</err:detailedMessage>
        <err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Precondition Failed</err:errorMessage>
        <err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
    >412</err:errorStatus>
    </rdf:Description>
</rdf:RDF>

Please anyone help me on it.

Thanks




0 votes

Comments

Does the etag specified in your If-Match header match the current etag of the artifact you are updating? A mismatch between the two is the most common pause of a precondition failure.

1) When you did the GET to retrieve the current resource RDF to modify you received a response with an etag header. Copy the value of this header to the If-Match header on the PUT.

2) there's no need for an etag header on the PUT.


Is the oslc_config.context in the request body supposed to be URL encoded?

<rdf:RDF

<rdf:Description rdf:about="https://servername/rm/resources/BI_Dlbl4AqtEe69NrAZG_EKYw?oslc_config.context=https%3A%2F%2Fservername%2Frm%2Fcm%2Fstream%2F_zyIJ8LgSEe21Q_607LRcZA"> 

Yes, all values to all query parameters should be URL encoded.

It is in the RDF of the request body and it is not mentioned as query parameter.

None of the other values in the request body RDF are URL encoded. 

This RDF should be only: what was received from a GET, with modifications only where they are needed. If the config was received encoded then it should still be encoded for the PUT. I just tried a get and the config is URL-encoded.

showing 5 of 6 show 1 more comments


One answer

Permanent link

 Hi K P,

If-Match should match the E-tag, and you have missed OSLC-Core-Version: 2.0 as well.

Your If-Match looks to be a Artifact UUID since it has the slug TX_

0 votes

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

Question asked: Jun 14 '23, 8:38 a.m.

Question was seen: 1,133 times

Last updated: Jun 15 '23, 12:40 p.m.

Confirmation Cancel Confirm