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

Renaming Folder via OSLC REST API

Hi,


I am not succeeding in performing PUT-request to rename an existing folder, the request results in: "The remote server returned an error: (403) Forbidden" 

The header in use are:
...
httpWebRequest.Headers.Add("OSLC-Core-Version", "2.0")
httpWebRequest.Headers.Add("Configuration-Context", "https://x.x.x.x/rm/cm/stream/_m7mO8HUeEeuc2f2NAwVSqg")
httpWebRequest.Headers.Add("If-Match", ETag)
httpWebRequest.Accept = "application/rdf+xml"
httpWebRequest.Method = "PUT"
httpWebRequest.ContentType = "application/rdf+xml"
...

The body for the PUT request as follows:
<rdf:RDF 
  <dcterms:title>NEW_TITLE</dcterms:title>
  <dcterms:description>Created by</dcterms:description>
  <nav:parent rdf:resource="https://x.x.x.x/rm/folders/_ugK-0TDHEeyE7Lq3bj8ZRQ" />  
  <oslc_config:component rdf:resource="https://x.x.x.x/rm/cm/component/_m7ZaoHUeEeuc2f2NAwVSqg" />
  <oslc:serviceProvider rdf:resource="null" />
</nav:folder>
</rdf:RDF>

Do anyone have a suggestion what is failing in my request?

Kind Regards 
Magnus 

0 votes

Comments

 403 means you don't have permission - possibly your client isn't authenticated, or your user doesn't have permission to make that change. Can you make the change manually? Have you tried the PUT using a browser REST client which is already authenticated?


Why is the oslc:serviceProvider null? I get a value for this when I get a folder URL. 

You are doing GET then only modifying the dcterms:title and doing the PUT, aren't you? i.e. you should PUT everything from the GET with the only difference being the dcterms:title.

You should have a header Content-Type: application/rdf+xml but AFAICT the PUT works without that header. Not sure where you get the ETag value from as I can't see one on the GET response, and the If-Match header doesn't seem to be required.


The other possibilities are that you're not using the correct URL for the folder, or that you're not providing all the auth-related cookies that were sent when your client code successfully authenticated.

I can manually create and change folders from the Web UI and I have successfully created folders using the REST Client. The same folders I tried to change name to using same client.   

Furthermore, updating artefacts works well, from the same authenticated client and I have tried with and without the If-Match header and the URL for the folder is the same as exposed in the web ui.

I recon that Content-Type: application/rdf+xml equals httpWebRequest.ContentType = "application/rdf+xml"

I can't see why there is a null for the service provider. However, I did another failed attempt to update the folder title and description using the GET and PUT, for update, using a correct value for the service provider.

What version and ifix?

Have you tried tracing what your app actually sends using a mitm proxy like Telelrik Fiddler (Windows) or mitm (*nix)? Do that, then compare with what a REST client like Postman sends for the same PUT.

The version is 6.0.6.1 and iFix017.


Will try tracing next week

Thank for advise! 


Be the first one to answer this question!

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: Nov 08 '21, 3:00 p.m.

Question was seen: 740 times

Last updated: Nov 12 '21, 10:20 a.m.

Confirmation Cancel Confirm