Updating the parent container of an attachment

I’d like to update the parent container (non-binary data) of an attachment in a Confluence page using Cloud REST API and “curl” command. I looked up the REST API endpoint URL and found this:

PUT /rest/api/content/{id}/child/attachment/{attachmentId}

Could somebody provide an example for a correctly constructed JSON input to achieve this? I tried the one below but it fails:

curl -v -u 'admin:xxx' -X PUT -d '{"id": “att000","title":"test.jpeg","type":"attachment","version": {"number": 2,"minorEdit": false},"container":"/rest/api/space/xxx"}' -H 'X-Atlassian-Token:xxx' -H 'Content-Type:application/json' https://xxx.atlassian.net/wiki/rest/api/space

Thank you for your time!

Your example looks correct except that its PUTting to /api/space instead of /content/{id}/child/attachment/{id}.

Do you get a response from Confluence after changing the URL?

The values you are setting in container property is not correct.

Replace it with:

“container”:{“id”:“123456”,“type”:“attachment”}