Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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. 

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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..

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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 DPKJ likes this
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 18, 2019
TAGS
AUG Leaders

Atlassian Community Events