I can create the page with a command like:
curl -D- -u 'U:P' -X POST -H "Content-Type: application/json" -d @DOC.json "https://url/wiki/rest/api/content?title=Test+Doc&spaceKey=MD"
This works! And the doc is created. Then I goto the page in a browser and get it id?
https://url/wiki/spaces/MD/pages/4784186/Test+Doc
Then I use a GET to get the data using the id 4784186
curl -D- -u 'U:P' -X GET -H "Content-Type: application/json" https://url/wiki/rest/api/content/4784186
And I get info about the page:
{"id":"4784186","type":"page","status":"current","title":"Test Doc","space":{"id":196609,"key":"MD","name":"xxxxx","type":"global","status":"current","_expandable":{"settings":"/rest/api/space/MD/settings","metadata":"","operations":"","lookAndFeel":"/rest/api/settings/lookandfeel?spaceKey=MD","permissions":"","icon":"","description":"","theme":"/rest/api/space/MD/theme","history":"","homepage":"/rest/api/content/196610"},"_links":{"webui":"/spaces/MD","self":"https://.../wiki/rest/api/space/MD"}},"history":{"latest":true,"createdBy":{"type":"known","accountId":"5d9b7a4af8c67f0dbff6b290","accountType":"atlassian","email":"u@comp.com","publicName":"user","profilePicture":{"path":"/wiki/aa-avatar/5d9b7a4af8c67f0dbff6b290","width":48,"height":48,"isDefault":false},"displayName":"Craig Smith","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https://.../wiki/rest/api/user?accountId=5d9b7a4af8c67f0dbff6b290"}},"createdDate":"2019-10-29T20:38:35.616Z","_expandable":{"lastUpdated":"","previousVersion":"","contributors":"","nextVersion":""},"_links":{"self":"https://.../wiki/rest/api/content/4784186/history"}},"version":{"by":{"type":"known","accountId":"5d9b7a4af8c67f0dbff6b290","accountType":"atlassian","email":"user@comp.com","publicName":"name","profilePicture":{"path":"/wiki/aa-avatar/5d9b7a4af8c67f0dbff6b290","width":48,"height":48,"isDefault":false},"displayName":"Craig Smith","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https://.../wiki/rest/api/user?accountId=5d9b7a4af8c67f0dbff6b290"}},"when":"2019-10-29T20:38:35.616Z","friendlyWhen":"yesterday at 4:38 PM","message":"","number":1,"minorEdit":false,"syncRev":"0.confluence$content$4784186.2","syncRevSource":"synchrony-ack","confRev":"confluence$content$4784186.5","_expandable":{"collaborators":"","content":"/rest/api/content/4784186"},"_links":{"self":"https://.../wiki/rest/api/content/4784186/version/1"}},"macroRenderedOutput":{},"extensions":{"position":1872770356},"_expandable":{"childTypes":"","container":"/rest/api/space/MD","metadata":"","operations":"","children":"/rest/api/content/4784186/child","restrictions":"/rest/api/content/4784186/restriction/byOperation","ancestors":"","body":"","descendants":"/rest/api/content/4784186/descendant"},"_links":{"editui":"/pages/resumedraft.action?draftId=4784186","webui":"/spaces/MD/pages/4784186/Test+Doc","context":"/wiki","self":"https:/.../wiki/rest/api/content/4784186","tinyui":"/x/OgBJ","collection":"/rest/api/content","base":"https://.../wiki"}}
Then I try a PUT:
curl -D- -u 'U:P' -X PUT -H "Content-Type: application/json" -d @Text.json "https://.../wiki/rest/api/content/4784186
I get a HTTP 400 response:
HTTP/2 400
server: AtlassianProxy/1.15.8.1
cache-control: no-cache, no-store, must-revalidate
content-type: application/json
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Wed, 30 Oct 2019 14:31:29 GMT
atl-traceid: 6906da9b9b242901
expires: Thu, 01 Jan 1970 00:00:00 GMT
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
atl-confluence-via: h:confluence-prod-us-7-3.prod.atl-paas.net
{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"}
With the only detail message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"
Any ideas on what I am doing wrong. Any ideas on what to try?
Another try using the doc name:
curl -D- -u 'U:P' -X PUT -H "Content-Type: application/json" -d @Test.json "https://.../wiki/rest/api/content?title=Test+Doc&spaceKey=MD"
HTTP/2 400
server: AtlassianProxy/1.15.8.1
cache-control: no-cache, no-store, must-revalidate
content-type: application/json
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Wed, 30 Oct 2019 14:37:25 GMT
atl-traceid: 0a2d9bad15d046ac
expires: Thu, 01 Jan 1970 00:00:00 GMT
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
atl-confluence-via: h:confluence-prod-us-7-3.prod.atl-paas.net
{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"}Craigs-MacBook-Pro:tmp csmith$
Craigs-MacBook-Pro:tmp csmith$
Craigs-MacBook-Pro:tmp csmith$ vi put_to_confluence.sh
Craigs-MacBook-Pro:tmp csmith$ ./put_to_confluence.sh
./put_to_confluence.sh: line 6: unexpected EOF while looking for matching `"'
./put_to_confluence.sh: line 8: syntax error: unexpected end of file
Craigs-MacBook-Pro:tmp csmith$ vi put_to_confluence.sh
Craigs-MacBook-Pro:tmp csmith$ ./put_to_confluence.sh
HTTP/2 405
server: AtlassianProxy/1.15.8.1
content-type: application/octet-stream
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Wed, 30 Oct 2019 14:44:16 GMT
atl-traceid: f866e40a3b5f49b6
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
atl-confluence-via: h:confluence-prod-us-7-3.prod.atl-paas.net
allow: HEAD,POST,GET,OPTIONS
content-length: 0