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

REST API create project

Hello, 

I've been searching on this forum and Google to find a way to create projects using Rest API. I'm not familiar with all of this and I don't find solutions really easy to understand. 

Could someone explain how to do it :) ? I've generated credentials, even the base64 Basic auth for the request. 

Thank you !  a

2 answers

1 accepted

0 votes
Answer accepted
DPK J Community Leader Dec 18, 2019

@Administrateur HawaiiFirst of all, welcome to the community!

Service Desk project are special kind of Jira Projects, so you can create Service Desk project using Jira's REST API by passing appropriate options, which all are explained in below API documentation link.

Please take a look at this - https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-project-post

ok I followed instructions but when trying with curl I get 

 

curl --request POST --url 'http://mysite.net/rest/api/3/project' --user 'usermail:api key'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--data '{
"notificationScheme": 10021,
"description": "Example Project description",
"lead": "Julien",
"url": "http://mysite.atlassian.net",
"projectTemplateKey": "com.atlassian.servicedesk:simplified-internal-service-desk",
"avatarId": 10200,
"name": "TESTAPI",
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "service_desk",
"key": "TESTAPI",
"categoryId": 10120
}'

 

what should I change ? 

 

THx

DPK J Community Leader Dec 18, 2019

@Administrateur Hawaii  Can you please elaborate on the error you are getting?

Oh sry I forgot half of the message... 

 

So Curl tells me that http protocol isn't supported. I mean I did exactly as in the tutorial this is going to make me crazy. 

DPK J Community Leader Dec 18, 2019

oh! it is simple error, replace all your 'http' instance with 'https', Jira Cloud doesn't work on http, it only work on https, and hence the error.

It's not xD Same error https not supported or deactivated in libcurl. So I tried removing quotes from host then I get html with unauthorized error.

Then curl says : 

 

curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: notificationScheme
curl: (6) Could not resolve host: 10021,
curl: (6) Could not resolve host: description
curl: (6) Could not resolve host: Example Project description,

 

I mean why would it think this parameters are used for host, they are not..

DPK J Community Leader Dec 18, 2019

@Administrateur Hawaii  the code below I have added to test.sh file and excuted, and it worked for me, please check.

#!/bin/bash

curl --request POST \
--url 'https://<SITE>.atlassian.net/rest/api/3/project' \
--user '<EMAIL>:<TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"description": "My Example Project",
"projectTemplateKey": "com.atlassian.servicedesk:simplified-it-service-desk",
"name": "Example Project",
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "service_desk",
"key": "EXP",
"leadAccountId": "<MY_ACCOUNT_ID>"
}'

 

You can later run this file,

$ chmod +x text.sh
$ ./test.sh

"was expecting double-quote to start field name\" 

 

That's what I get :/ I'm on Windows by the way :) Maybe that's why it does that. 

 

EDIT: Ok next step I get the error "this project template does not exist..." 

 

curl --request POST \
--url 'https://yoursite/rest/api/3/project' \
--user 'usermail:<apikey>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"description": "My Example Project",
"projectTemplateKey": "com.atlassian.servicedesk:itil-v2-service-desk-project",
"name": "Example Project",
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "service_desk",
"key": "EXP",
"leadAccountId": "<accountid>"

}'

 

This worked perfectly :) 

 

By the way to found account id : people>select account > last alphanumeric part of url ex in bold here : /aaazer1651ezgfzeg156

Like DPK J likes this
DPK J Community Leader Dec 18, 2019

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Align

Best Practices in Jira Align

Hello Jira Align customers! In order to better serve you on your journey with Jira Align, the Community team has worked with the Jira Align team to curate the content in this collection to better s...

182 views 0 9
Read article

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