Forums

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

Trying to Automate Project creation, blocked by REST API returning 500 status code

surya manne October 17, 2021

I am trying to automate Project creation from an Automation Rule.

The GET REST API returns 200 response code, however, the "POST" API is returning 500

what am I missing?

 

http method POST - https://jira-xyz.atlassian.net/rest/api/3/project

Headers-
authorization: Basic setsdkjfkjhdxtjydfgl
Content-Type : application/json

custom data -
{
"notificationScheme": 10021,
"description": "Cloud migration initiative",
"leadAccountId": "569565786957",
"url": "https://jira-xyzabc.atlassian.net",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-process-control",
"name": "Example",
"permissionScheme": 10011,
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "business",
"key": "EX",
"categoryId": 10120
}

 

 

2 answers

0 votes
Alex Koxaras _Relational_
Community Champion
October 17, 2021

@surya manne hi and welcome to the community!

On the post method you use this URL https://jira-xyz.atlassian.net/rest/api/3/project, but inside your date you use this one https://jira-xyzabc.atlassian.net

Could that possibly be the problem?

surya manne October 17, 2021

@Alex Koxaras _Relational_ Thanks for the response

I get the same 500 response as well while using " https://jira-xyz.atlassian.net"  inside the data

Alex Koxaras _Relational_
Community Champion
October 18, 2021

Hi @surya manne 

I've successfully managed to create a project via REST API, using the following code, which is suitable for me:

{
"notificationScheme": 10000,
"description": "Cloud migration initiative",
"url": "https://koxaras.atlassian.net",
"avatarId": 10200,
"issueSecurityScheme": 10000,
"leadAccountId": "5f9fb7c1c2e5390077abf628",
"projectTemplateKey": "com.pyxis.greenhopper.jira:gh-simplified-basic",
"name": "Example",
"permissionScheme": 10000,
"projectTypeKey": "software",
"key": "EX",
"categoryId": 10000
  • First and foremost, you have to make sure that the URL is the same both in your data, as well as on the webhook
  • Then you have to go ONE-BY-ONE and make sure that ALL IDs are valid for your instance
    • notification scheme
    • issue security scheme
    • persmission
    • category id
  • Then you have to add the correct LEAD id

In the example below, I change the project type to that of a kanban.

project rest api.png

surya manne October 18, 2021

Hi @Alex Koxaras _Relational_ 

 

I get the same 500 response

Copied the above, changed the lead id (my account), URL(same for webhook and data), and used "10011" permission scheme
surya manne October 18, 2021

it's in Jira Cloud

Alex Koxaras _Relational_
Community Champion
October 18, 2021

Does any of these domain you are using exists? It seems that I can't find any of these two.

Alex Koxaras _Relational_
Community Champion
October 18, 2021

On the basic authorization, did you embed as well your email address with the api token you created?

surya manne October 18, 2021

Yes, basic authorization with email address and API Token (Base64 encoded)

Alex Koxaras _Relational_
Community Champion
October 18, 2021

Well. that's strange then. It seems that you've done everything correct and for a odd reason it doesn't work! I would probably contact Atlassian's support, if you are on a paid plan. From my side I can only tell you that I've manage to do it. If you however are willing to share some more info (like token, schemes id etc) I could try to experiment a bit. That's up to you.

surya manne October 18, 2021

Thanks alot for your help Alex

0 votes
surya manne October 17, 2021

Screen Shot 2021-10-18 at 1.51.39 am.png

Joy Chiu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2021

Hi @surya manne ,

 

Here is a reference for creating a project API call:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-post

 

Have you tried to use curl to call the API based on your params to see if it works?

 

Cheers,

Joy [Auotmation for Jira]

surya manne October 17, 2021

Hi Joy

 

Same thing.

curl for POST does not work, however, curl GET works

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events