I have a service project used as a template and I want to automate the process of linking knowledge base for new project clones - this page can be accessed via project root -> settings -> knowledge base -> link space button. (see screenshot).
I can view the network traffic when I perform this and get the following curl:
curl --location --request POST '{jira_instance_host}/rest/servicedesk/1/servicedesk/{PROJECT KEY}/kb/{Id to link to}/space' \
--header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0' \
--header 'Accept: application/json,text/javascript,*/*' \
--header 'Accept-Language: en-US,en;q=0.5' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'Referer: https://{jira_instance_host}/jira/servicedesk/projects/CALLUMEX/settings/confluence-kb' \
--header 'Content-Type: application/json' \
--header 'Origin: {jira_instance_host}' \
--header 'Connection: keep-alive' \
--header 'Cookie: ajs_anonymous_id=some token; AWSALB=some token; AWSALBCORS=some token; cloud.session.token=some token; atlassian.xsrf.token=some token; JSESSIONID=some token; atlassian.xsrf.token=some token' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'TE: trailers' \
--data-raw '["ECT"]'
If I use basic auth with an api token as the password and removing the cookie in the header - it returns
500
{
"errors": [
{
"errorMessage": "We're having trouble communicating with Confluence. Wait a minute, then try again."
}
],
"reasonKey": "sd.applinks.error.generic.confluence.communication",
"reasonCode": "500"
}
I presume in the future this call will work using basic token auth, like many other calls do but in the meantime, I would like a way to generate those cookies in the Cookie header - it wouldn't bother me if it was 5 or so calls as it is intended to be put in a postman collection anyway.
I have had a look at the login process and can't quite work out where some of the cookies come from, namely ajs_anonymous_id, cloud.session.token, JSESSIONID