Create project with Java API

I’m trying to create a project programmatically.

I found this:

But validation will fail, unless I supply everything:

ProjectCreationData data = new ProjectCreationData.Builder()
					.withAssigneeType(Assignee Type as Long)
					.withAvatarId(Avatar ID as Long)
					.withDescription("Project Desc")
					.withKey("Project Key")
					.withLead("Username of lead")
					.withName("Project Name")
					.withType("Project Type Key")
					.withUrl("Project URL")
					.withProjectTemplateKey("Project Template Key")

The problem I have is with the project template. Validation will fail unless I provide an template, but if I provide the default template:


It will create default issue/workflow/screen schemes along with the project, and I don’t want that.

To create my own template, I found addProjectHook() in:

Which in turn requires a ConfigureData class:

The static create() method seems to be what I want, but it requires a Project… before I create the project.

How to programmatically create a project along with the associated issue/workflow/screen schemes, or how to create a project with no schemes attached, then configure the schemes afterwards?

We use this, more or less successfully, at my job today.

The documentation is poor but I can provide examples if needed.

I found out the problem. API doc states that you can either:

  1. Provide project type
  2. Provide project template
  3. Provide both

I provided an incorrect project type object (created one with a String key instead of searching for one), so the API wanted a project template instead.

With only project type and no project template, project is created without any issue/view/workflow schemes attached.

1 Like