cURL baseURL is not working

Miłosz Pawłowski February 27, 2025

Hey,

I'm getting error while trying to change baseURL via cURL, I'm using this command:

 

test='Authorization: Bearer PERSONAL_ACCESS_TOKEN' && curl -v -H "$test" -X PUT https://subdomain.domain.org/jira/rest/api/2/settings/baseUrl -H "Content-Type: application/json" -d '{"baseURL": "https://subdomain.domain.org/jira"}'
And I'm getting this error:


< HTTP/1.1 400

{"errorMessages":["The specified URL is not valid."],"errors":{}}% 

 

What could be the issue?

1 answer

1 accepted

3 votes
Answer accepted
Radek Dostál
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 27, 2025

Let me ask you a better question. How often do you change baseUrl. Does it really matter enough not to change it in web UI?

If you happen to have a valid use case, then okay, but I can't help but doubt it.

 

Also it turns out it isn't json it wants. It's a confused endpoint. It still wants a json content type, but it just wants a single string in data.

 

I.e. `-H 'Content-Type: application/json' -d 'https://test.com'` this worked.

 

Miłosz Pawłowski February 27, 2025

It worked! Such small change, thank you sir!

We are cloning our instance quite often and we needed that to finish our process.

Radek Dostál
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 27, 2025

Ah, makes sense.

Personally I find https://confluence.atlassian.com/jirakb/change-the-base-url-of-jira-server-in-the-database-733940375.html a bit nicer (as with cloning there's typically plenty SQL stuff to do anyway, e.g. licenses or applinks and so on so it kinda blends in).

Miłosz Pawłowski February 27, 2025

I wanted to use DB queries, but we couldn't change certificate for SSO via DB, but it's possible via cURL. Some cURLs:

//Change URL:
test='Authorization: Bearer PAT' && curl -v -H "$test" -X PUT https://server.org/jira/rest/api/2/settings/baseUrl -H "Content-Type: application/json" -d 'https://server.org/jira/'

//Change license:
test='Authorization: Bearer PAT' && curl -v -H "$test" -X POST https://server.org/jira/rest/plugins/applications/1.0/installed/jira-software/license/ -H "Content-Type: application/vnd.atl.plugins+json" -d '{"licenseKey":"LICENSE_KEY"}'

//Turn off outgoing mail server:
test='Authorization: Bearer PAT' && curl -v -H "$test" -X PUT https://server.org/jira/rest/jira-mail-plugin/1.0/outgoingMail/config -H "Content-Type: application/json" -d '{ "enabled": "false" }'

//Change SSO certificate:
test='Authorization: Bearer PAT' && curl -v -H "$test" -X PATCH https://server.org/jira/rest/authconfig/1.0/idps/1 -H "Content-Type: application/json" -d '{ "certificate": "SSO_CERT" }'

 

Suggest an answer

Log in or Sign up to answer