The documentation for the /rest/api/2/settings/baseUrl API does not include a valid example. I receive the message "The specified URL is not valid." when trying to PUT JSON data. Could somebody please provide an example of the correct JSON payload?
Update:
I'm using Postman to test sending the request. I can get to the JIRA server OK for other REST calls, such as serverInfo. I'm using http://10.0.0.20:8080/rest/api/2/settings/baseUrl to reach the server. I'm trying to set the baseUrl to "http://10.0.0.20:8080", as this was a restore to a VM on my workstation from another server. I'm trying to use the REST API in a bash script to perform an unattended installation.
The example in your link looks like just plain text, i.e. not JSON. However, the server responds with HTTP Status 415 - Unsupported Media Type when setting the Content-type header to text/plain.
I have tried a number of different Content-type application/json payloads like:
{ "baseUrl": "http://10.0.0.20:8080" } { "value": "http://10.0.0.20:8080" }
I'm just not sure what the JSON payload should be for the PUT request. Thanks.
Community moderators have prevented the ability to post new answers.
Looks like docs are not correct, this is not actually JSON, just simple payload.
This example works fine:
curl -v -u admin:admin -X PUT -H 'Content-Type:application/json' http://127.0.0.1:8080/rest/api/2/settings/baseUrl -d 'http://127.0.0.1:8080/' < HTTP/1.1 204 No Content
Thank you! Yes this made me a bit confused as well.
#Adding small example how to pass variable with curl curl -u $user:$password -X PUT --data 'https://'"$jira_system"'.domain.com' -H "Content-Type: application/json" https://$jira_system.domain.com/rest/api/2/settings/baseUrl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We've created a feature request to improve this, see
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dave,
Can you give more details about what URL are you passing and what call are you trying? Are you able to access the URL which you are facing issues by browser?
This documentation has an example: https://docs.atlassian.com/jira/REST/latest/#api/2/settings-setBaseURL
Regards,
Renato Rudnicki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No. It really doesn't give an example. Most items give an example of the expected JSON, but this one simply gives an example value, but not the expected structure. I'm experiencing the same issue as the original poster here. Can you provide any assistance?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is just weird. I got this to work, but not using JSON. You simply send the actual URL you want as the payload. No escaping, no structure, no JSON. Just silly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, no. I just assumed that it was a bug, or that the docs were wrong. I think that I ended up changing the base URL directly in the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you ever figure this out? Would love to know how to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good you really need to align all APIs :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.