Set version for page via API
I'm trying to setup version for page using call from
https://help.k15t.com/scroll-versions/latest/api-resources-144802064.html
MANAGE VERSIONED PAGES VIA REST
POST [confluence_base_url]/rest/scroll-versions/1.0/page/modify/VS?masterPageId=17989634&pageTitle=Changed%20title&versionId=7F00000101622F08E55548715DF477BA&changeType=Modify
the call does not work correctly with Cyrillic
for example
pageTitle=Changed%20title
title will be Changed0title - it not correct, but good. And page will be versioned
But we use Cyrillic:
pageTitle=Текст
I need to specify a page title in Cyrillic
-
Official comment
Hi Pavel,
the default character set used in the REST requests is UTF-8. Thus %20 is resolved to space. (We will check if there is a bug).
So using Cyrillic in the request will not work. I used https://www.w3schools.com/tags/ref_urlencode.asp > URL Encoding Functions to check how Текст is encoded in a URL.
Текст has a URL representation of %D0%A2%D0%B5%D0%BA%D1%81%D1%82
How do you trigger that call? If it is used from the UI or any other piece of code you should be able to URL encode your text using corresponding libs.
Does this answer your question?
Best,
TobiasComment actions -
Hi Tobias,
I test call via curl
curl.exe -u "user:password" --insecure https://wiki/rest/scroll-versions/1.0/page/modify/ASRU -d "masterPageId=202394582&pageTitle=%D0%A2%D0%B5%D0%BA%D1%81%D1%82&versionId=0A6573030164D1D88A766A147ED450F1&changeType=Modify" -X POST -H "X-Atlassian-Token:nocheck" -H "Content-Type:application/x-www-form-urlencoded" --output Response.txt --trace-ascii trace.txt
I know about encoder/decoder, but with pageTitle=%D0%A2%D0%B5%D0%BA%D1%81%D1%82 page will have title A2B5BA8182. It is not correct
-
Hi Roman!
I reproduced the request with the correct parameters and Cyrillic title.
In pyton (pageTitle can consist of Cyrillic alphabet):...
pageTitle=pageTitle.encode('utf-8')
params = {"masterPageId": masterPageId, "pageTitle": pageTitle, "versionId": versionId,"changeType": "Modify"}
url_params = urllib.urlencode(params)
url_post = self.uri_base + '/rest/scroll-versions/1.0/page/modify/' + self.space + '?' + url_params
data = ''
headers = {'X-Atlassian-Token': 'nocheck', 'Content-Type': 'application/x-www-form-urlencoded'}
response = requests.post(url_post, data=data, headers=headers,
auth=(self.username, self.password), verify=False)Thanks!
Please sign in to leave a comment.
Comments
4 comments