How to send ready html document via rest api

Kacper Nietuzinkovy November 7, 2019

I need to transfer some documents to confluence,
I already "convert" them to confluence format -> I can open (confluence) html editor on a new page, ctrl+a > delete all > ctrl+a (my converted html), ctrl+v > save - and document looks perfect.
But still I need to do it by opening manualy confluence editor and copy-paste my content.
I tried to put this content via curl and rest api using:

curl -u admin@example.com:api_token -X PUT -H 'Content-Type: application/json' -d'{"id":"3604482","type":"page","title":"new page","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is the updated text for the new page</p>","representation":"storage"}},"version":{"number":2}}' https://your-domain.atlassian.net/wiki/rest/api/content/3604482 | python -mjson.tool 

and for one line ex. "<p>This is the updated text for the new page</p>" it works well, but for my 140 lines html it doesn't... I also tried to put it into json file, but every ( " ' , ) breaks json syntax and escaping that will consume to much time...
Is it possible to sent it somehow?
Like I said I've got ready-to-paste html content in my file, how to put it via rest API ?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events