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

what is domian in this url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments"

Sachin Somannavar March 7, 2024

this is for rest api v2 , this url will give the attachemenst

url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments"

 

but for rest api 1

we have this url = https://api.atlassian.com/ex/confluence/cloudid/rest/api/content/{page_id}/child/attachment'    and getting all the attachements , since it is depricating  , we need to move to rest api v2  , but I am geting the issue  finding out the domian and I am using the acess token getting from Oauth2.0 for rest api 1 and it working and same I am using for rest api v2 

url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments" , finding difficulties in what is the domain and how to get details from this rest api v2 url

1 answer

1 accepted

4 votes
Answer accepted
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2024

HI @Sachin Somannavar 

 

{{your-domain}} is your instance. E.g. Let's assume that we are working on Confluence https://greatcompany.atlassian.net and greatcompany.atlassian.net is {{your-domain}}.

 

Regards,

Seba

Sachin Somannavar March 7, 2024

if we use Oauth2.0 token , then it is not working here 

 

import requests
from requests.auth import HTTPBasicAuth
import json
api_token = ""
headers = {'Accept': 'application/json'}
 
auth = HTTPBasicAuth("", api_token)
response = requests.request(
   "GET",
   url,
   headers=headers,
   auth=auth
)
response.raise_for_status()  # Raise an exception for non-200 status codes
 
data = response.json()
print(data)  , it is working but if we use this and I have tested this 
but for this 
    headers = {'Authorization': f'Bearer {access_token}', 'Accept': 'application/json'}
 
    response = requests.get(url, headers=headers)
    response.raise_for_status()  # Raise an exception for non-200 status codes
    
    data = response.json()
    print(data)
    
 
    return response.json(), here we are getting the access token from Oauth2.0 and this is working well in rest api version like getting the atatchmensts and all the thing but in rest api 2 it is not working

Suggest an answer

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

Atlassian Community Events