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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Create a Jira project from Powershell with REST API

I am trying to create a new project in Jira from Powershell using REST API.

I have the following code, but it is giving me http error 400. I can't figure out where the problem is, most likely in the json part, but how to pinpoint the exact error?

$npuri = "$baseurl/rest/api/2/project"
$npjson = "{    `"key`": `"MNew`",
    `"name`": `"M Software Sample`",
    `"projectTypeKey`": `"business`",
    `"projectTemplateKey`": `"com.atlassian.jira-core-project-templates:jira-core-project-management`"
,    `"description`": `"Example Project description`"
    `"lead`": `"userid`",
    `"assigneeType`": `"PROJECT_LEAD`",
    `"avatarId`": 10262,
    `"permissionScheme`": 10342,
    `"notificationScheme`": 10000,
    `"categoryId`": 10120
$response=Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json" -Uri $npuri -Body $npjson -Method POST

A basic query using same base URL and authentication works.

1 answer

0 votes
Leonard Chew Community Leader Jan 03, 2020

I don't know where the problem is, but here are some ideas to narrow down the problem:

  • use a different client (for isntance a browser plugin) to "play" with your rest-service
  • wrap your json body in single-quotes, then you dont need to escape your double quotes
  • use a simpler use-case (something like create issue) to start with before creating a project, as to test your body syntax


Thanks for your suggestions. Using postman, I was able to clear up the JSON syntax, mostly by removing all unnecessary fields.

I also changed the way the JSON body was constructed:

$hash = @{    key"KEY";
    name"TG Software Sample";
    description"Example Project description";

$json = $hash | ConvertTo-Json

 After that, a project was created successfully on Jira.





Suggest an answer

Log in or Sign up to answer

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