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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira admin REST API calls return HTML instead of JSON

1. I created an API token here first: https://admin.atlassian.com/o/<orgId>/admin-api

2. Here is my request from postman:

curl -X GET \
https://api.atlassian.net/admin/v1/orgs \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Bearer <token>' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: api.atlassian.net' \
-H 'User-Agent: PostmanRuntime/7.15.2' \
-H 'cache-control: no-cache'

3. I get 200 response code back but the body is being returned as HTML. 

4. Instead of Bearer auth i tried basic auth and got the same result. 

5. It specifically happens only with the admin REST endpoints, regular ones like 'rest/api/2/issue/<issue id>' with different api token requested here: https://id.atlassian.com/manage/api-tokens totally works.  

 

I assume I am missing something incredibly simple. I searched through docs and blogs and stackoverflow, but I seem to fail at getting JSON back. Any ideas what i might be missing?

1 answer

0 votes
brbojorque Community Leader Jan 01, 2020

Hi @Sasha Korobko ,

I'm not sure what are you trying to accomplish in accessing the Organization API.

Try to look into this documentation. 

PS. Postman requests are available also, you need to generate the Organization API key here: https://confluence.atlassian.com/cloud/create-an-admin-api-key-969537932.html

-

Organization API

https://developer.atlassian.com/cloud/admin/organization/rest/

Hi Everyone,

I got the same kind of issue than Sasha.

I use basic authentification with a token. I have revoked my last token and created a new one, it did not change anything. the Api /rest/api/latest/search?jql=Project=... still return HTML instead of JSON as requested in my header :

"Content-Type", "application/json"
"Accept", "application/json" 

Can you share a solution please ?

Thank you

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you