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
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:nav="http://jazz.net/ns/rm/navigation#"
xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/">
<nav:folder rdf:about="https://x.x.x.x/rm/folders/_8rLhIUDPEey2VZy3eLLbiw
<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" />
<nav:subfolders rdf:resource="https://x.x.x.x/rm/folders?oslc.where=public_rm:parent=https://x.x.x.x/rm/folders/_8rLhIUDPEey2VZy3eLLbiw" />
<oslc:serviceProvider rdf:resource="null" />
</nav:folder>
</rdf:RDF>
Do anyone have a suggestion what is failing in my request?
Kind Regards
Magnus
|
Be the first one to answer this question!
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.
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?
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.
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.
Thank for advise!