Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting 401-Unauthorized Error trying to access attachments using Atlassian API

Linda Zhao January 9, 2024

I am running the following code:

import requests

from requests.auth import HTTPBasicAuth

import json

url = "https://foo.atlassian.net/wiki/api/v2/attachments"

auth = HTTPBasicAuth("foo.bar@foobar.com", "MY_API_TOKEN")

headers = {

  "Accept": "application/json",

}

response = requests.request(

  "GET",

  url,

  headers=headers,

  auth=auth

)

print(response)

 essentially the exact copy of the code snippet provided here:
https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-attachment/#api-attachments-get

 

but i am getting a 401 error despite definitely using the correct API key and using the site admin email

Is this anything to do with the fact that I am on the free version?

If not is there a permission i need to configure on the Atlassian side so that this request goes thru?

1 answer

0 votes
Nikola Perisic
Community Champion
January 10, 2024

Hello @Linda Zhao ,

API's are available for all of the pricing models. Make sure that all of the credentials are correct.

If nothing works from the above raise a support ticket for Atlassian.

BR,

Nikola

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events