Creating a JSD project using /rest/api/2/project leads to "Internal Server Error"

rest-api

#1

I try to create a JSD project for a test system (testing a webhook on project creation).

curl -X POST \
  http://localhost:2990/jira/rest/api/2/project \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "key": "SD",
    "name": "Service Desk",
    "projectTypeKey": "service_desk",
    "projectTemplateKey": "itil-service-desk-project",
    "description": "Example Project description",
    "lead": "admin",
    "url": "http://atlassian.com",
    "assigneeType": "PROJECT_LEAD",
    "permissionScheme": 10000,
    "notificationScheme": 10000
}

and I get in return:

{
    "errorMessages": [
        "Internal server error"
    ],
    "errors": {}
}

I also tried it on a JSD server hosted on AWS with the same result. JSD Server Version is 3.15.0.

As hint for the reason I found in the server log:

Caused by: java.lang.IllegalArgumentException: Invalid module key specified:
	at com.atlassian.plugin.ModuleCompleteKey.<init>(ModuleCompleteKey.java:49)

I didn’t find anything useful on Google. Therefor here …
What could create the error?


#2

Hello @m.schmidt,

You have an invalid entry for projectTemplateKey and that’s causing the error; I think you’re specifically looking for com.atlassian.servicedesk:itil-v2-service-desk-project. To find out the possible values, you might want to explore the private API /rest/project-templates/1.0/templates. You can call this in your instance’s REST API Browser and uncheck Show only public APIs. The property you’ll be interested in is projectTemplateModuleCompleteKey.

Hope this helps!
Ian

PS: I tried it now and it works on my instance using JSD v3.15.2.


#3

Yes, that works. Thanks also for the link.