Updating DNG attribute value with POST request using widget throws 403 Forbidden Error
Hello,
I am trying to update a DNG artifact attribute within a module using a widget, but while updating it through widget, I get "403 Forbidden" Error after the POST command is executed in the background.
Steps in background :
1. Change set is created and widget is hosted in personal global stream.
2. Widget triggers a GET request for each artifact, stores the response including the "ETag" header value.
3. It forms relevant content to be updated in the artifact as response body, appropriate headers including "IF-Match" with above Etag value is added and POST request is executed.
After above steps, the attribute is not updated and it throws "403 Forbidden Error" in background.
The same logic is applied in java application and it works fine without any such error.
Could you please help?
One answer
A 403 can be caused by a number of things, but in this case it is likely because you are doing a POST (create) when you should be doing a PUT (update).
Comments
Hello Kirk,
412 is closer to working than 403 :-) I've seen 412 when a) the etag from the GET wasn't copied correctly into the If-Match header on the PUT, or b) when the etag in If-Match isn't valid any more because an update had been made since the GET, so the old etag from my GET was no longer correct. Don't modify the etag at all, simply copy from etag header into if-match header. As you say you're working in a changeset the second shouldn't apply - if you weren't in a changeset and if someone else had changed the artifact since you collected the etag, then the logic of, perhaps, retrying is a bit perilous because your update might overwrite the other update, so it may be best to stop and let the user decide what to do.
Comments
Matthias Buettgen
Nov 06 '20, 8:39 a.m.Anyway, did you consider using the RM Client Extension API?
Jyotsna Prasad
Nov 10 '20, 2:15 a.m.Hi Matthias,