Hello!,
I need to know if it is possible via rest api to show an attachment on a confluence page as if it were a kind of hyperlink, with a custom text.
I'm trying to do this but it doesn't work for me:
node {
stage("Create hyperlink to attachment"){
sh """
curl -s -D- -H "Authorization: Basic XXXXXXXXXX:XXXXXXXXXXXX" -X PUT -H 'Content-Type: application/json' -d'{
"id": "84652952",
"type": "page",
"status": "current",
"title": "Prueba-Jenkins",
"body": {
"storage": {
"value":
"<ac:link>
<ri:attachment ri:filename="FILENAME.docx"/>
<ac:plain-text-link-body>
<![CDATA[RANDOM COMMENT]]>
</ac:plain-text-link-body>
</ac:link>",
"representation": "storage"
}
}
}' https://XXXXXXXXXXXXXX/confluence/rest/api/content/84652952
"""
}
}
Is this way of working correct?
Thanks in advance,
Adolfo S.
Below CURL command did the trick for me. I used shell script and for convenience I have entered every value in a new line, in actual I executed this as a one liner.
Key things to note
curl -u 'username:password' -X PUT -H 'Content-Type: application/json' -d '{
"id": "00000000",
"type": "page",
"title": "New page",
"space":{"key":"Test"},
"body":{"storage":{"value":"<table class=\"wrapped\"><colgroup><col /></colgroup><tbody><tr><th><h3>Hyperlink Text</h3></th></tr><tr><td><ac:link><ri:attachment ri:filename=\"Test.csv\" /><ac:plain-text-link-body><![CDATA[Bitbucket_AD_Userlist]]></ac:plain-text-link-body></ac:link></td></tr></tbody></table>",
"representation":"storage"}},
"version":{"number":4}}'
https://confluence.org.com/rest/api/content/00000000
Reference: https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/ (Update a Page part)
I have the same question.
@Adolfo Santiago Risquez Did you get the answer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can someone help me?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.