Forums

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

Create issue with REST API via oAuth2

Jens May 13, 2025

Hi, 

we are aggregating and analysing server logs with graylog. Now we like to create jira issues for certain events. 

We like to solve this using oAuth2 access via the developer console following this instructions: https://support.atlassian.com/jira/kb/how-to-use-oauth20-in-postman-client-for-jira-cloud-apis/

Authorisation already works

But i have trouble putting the request URL together. In step 3 the documentation tells me to use a site id for the xxx in the request URL. I don't know what the site id is. I tried than using the app id from the oauth app i created in the developer console. This didn't work.

My Request Example

I substituted the xxx with the app id, as i dont know yet what a site id is. 

curl --location 'https://api.atlassian.com/ex/jira/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/rest/api/2/project' \
--header 'Accept: application/json' \
--header 'Authorization: ••••••'

The response

{
"timestamp": "2025-05-13T08:41:24.618827397Z",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/ex/jira/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/rest/api/2/project"
}

Permissions
classic scope
- read:jira-work
- manage:jira-project
- write:jira-work

granular scope
- read:issue:jira
- write:issue:jira
- read:project:jira
- write:project:jira
- read:issue:jira-software
- write:issue:jira-software

2 answers

1 vote
Abdallah Khaled
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2025

Hello @Jens, It's important to mention that the site ID (also known as cloud ID or Tenant ID) is a unique identifier for your Jira cloud instance. It is not the same as the app ID you created in the developer console. You can find your cloud ID from the admin console following the steps on this page here.

Jens May 15, 2025

Hi Abdallah, 

thx for the explanation. I got the site id with https://###########.atlassian.net/_edge/tenant_info

But, even with the correct site id in my request, i still get a 404 while asking for project or issue:

curl --location 'https://api.atlassian.com/ex/jira/#######-#####-####-####-##########/rest/api/2/project' \

--header 'Accept: application/json' \

--header 'Authorization: ••••••'

TinyTake15-05-2025-10-25-35.png

Abdallah Khaled
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2025

I beleive you're using the incorrect API endpoint; you can rely on this page here for Jira APIs, for example, to get the Projects on your site:

https://xxxx.atlassian.net/rest/api/3/project, using your site name

Screenshot 2025-05-15 at 10.48.57 AM.png

Jens May 15, 2025

Using https://xxxx.atlassian.net/rest/api/3/project with oauth2 Authentification gets me an 401 Unauthorized

2.png

The documentation i used https://support.atlassian.com/jira/kb/how-to-use-oauth20-in-postman-client-for-jira-cloud-apis/ states in step 3 this structure for the REST URL: https://api.atlassian.com/ex/jira/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/rest/api/2/project

 

 

Abdallah Khaled
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2025

Aha, I tested as well with OAuth 2.0 token following the same steps and I was able to get the projects:

Make sure that you add the Authorization header as Bearer <token>.

image.png

Jens May 15, 2025

When i am accessing the API with  https://api.atlassian.com/ex/jira/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/rest/api/2/project the authentification is successful. 

2.png

The Problem is that i can't access any ressources. Maybe i did something wrong with the permissions?

10.png

11.png

12.png

Jens May 26, 2025 edited

Hi, i now tried using REST Access with an API Key. First a used the same scopes as with the oauth 2 approach. That gets me an 404. Then i tried the deprecated API Key without scopes. And that gets me data. So there is something wrong with my scopes.  

This works with API-Key without scopes:

POST https://#######.atlassian.net/rest/api/3/issue/
Authorization: Basic ##########
Content-Type: application/json

{
"fields": {
"project":{
"id":"#####"
},
"summary": "Main order flow broken",
"issuetype": {
"id": "10001"
}
}
}

 

 

0 votes
Jens May 30, 2025

There seems to be a maybe related bug issue here: https://jira.atlassian.com/browse/JRACLOUD-94545 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events