I have few data in csv file, so I am trying to create table, put csv file data to table and update confluence page. But I am unable to upload data to confluence page its showing 500 internal server error. Below code I am using. Any suggestions pls bash or python is fine. Thanks in advance
#!/bin/bash
set -x
confluence_user="admin"
confluence_password="admin"
confluenceUrl="https://confluence.com/rest/api/content/123456789"
content=$(awk -F',' 'BEGIN{ print "<table><tr><th>Name</th><th>Bounce</th><th>Department</th></tr>"}
{ print "<tr><td>" $1 "</td><td>" $2 "</td><td>" $3 "</td></tr>" }
END{ print "</table>"}' input.csv)
#Confluence Calls
response=$(curl -X GET ${confluenceUrl} \
-H 'Content-Type: application/json' -k \
-u ${confluence_user}:${confluence_password})
version_temp=${response##*'number":'}
version=${version_temp%%%%','*}
version=$((version+1)) #increment the version
response=$(curl -X PUT ${confluenceUrl} \
-H 'Content-Type: application/json' -k \
-u ${confluence_user}:${confluence_password} \
-d '{
"id": 123456789,
"type": "page",
"title": "csv page",
"body": {
"storage": {
"value": "${content}",
"representation": "storage"
}
},
"version": {
"number": "'"${version}"'"
}
}')