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

baseUrl REST API

Dave Sousa December 1, 2015

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.

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Andriy Yakovlev [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2016

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
Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2017

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
Andriy Yakovlev [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 20, 2018

We've created a feature request to improve this, see 

https://jira.atlassian.com/browse/JRASERVER-67627

Like Maurice Forster likes this
1 vote
rrudnicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2015

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

Bradley McCrorey May 4, 2016

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?

0 votes
Bradley McCrorey May 17, 2016

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. 

0 votes
Dave Sousa May 4, 2016

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.

0 votes
Bradley McCrorey May 4, 2016

did you ever figure this out? Would love to know how to do this.

Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2018

Good you really need to align all APIs :)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events