Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Adding link to attachment in Confluence Page Via Rest API Edited



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": {
<ri:attachment ri:filename="FILENAME.docx"/>
"representation": "storage"
}' https://XXXXXXXXXXXXXX/confluence/rest/api/content/84652952


Is this way of working correct?


Thanks in advance,

Adolfo S.

3 answers


Can someone help me?


I have the same question. 

@Adolfo Santiago Risquez Did you get the answer?

@Ganesh Kumar 


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


  • Escape any double quotes if any inside the storage value part. I have highlighted the portions in BOLD where I used '\'  to escape double quotes 
  • Mention the version number correctly. It has to be +1 of your current page version

curl -u 'username:password' -X PUT -H 'Content-Type: application/json' -d '{
"id": "00000000",
"type": "page",
"title": "New page",
"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>",


Reference: (Update a Page part)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

408 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you