I want to create a jira project in a Perl environment

Hi, Team.

I am a beginner in Jira and want to create a jira project using the JIRA REST API in a Perl environment.

So I saw the information (URL) below. However, there are no examples of Perl environment.
https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-project-get

So I saw JIRA :: REST and JIRA :: Client: Automated module. But I could not get the answer I wanted.

I do not know what to do. I am waiting for your help.

Alex.

It’s been a while since I really dug into Perl but if memory recalls I would look at the url module (if memory serves me as well - there’s an Lwp module). That in conjunction with basic auth (in cloud look at api tokens for the passwords) you should be able to use the rest of the docs.

Hello again, Alex. Building on top of your previous posts like I want to print only specific field values of a specific issue - #4 by iragudo, you might want to try something like

# create a project
my $project = $jira->POST('/project', undef, {
	key => 'PERL',
	name => 'Perl example',
	projectTypeKey => 'business',
    #some more required parameters in the docs
	...
});

You can pattern it in the sample create issue in JIRA::REST - Thin wrapper around Jira's REST API - metacpan.org.

Hi, iragudo.
I always appreciate your help.
I created the source as an attachement.

But then an error occurs.
F:\ideaic\perl\site\lib>perl ideaic_interface_jira_create.pl
JIRA::REST Error[400 - Bad Request]:
-Unrecognized field “leadAccountId” (Class com.atlassian.jira.rest.v2.issue.project.ProjectInputBean), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@1c4b8d2f; line: 1, column: 196] (through reference chain: com.atlassian.jira.rest.v2.issue.project.ProjectInputBean[“leadAccountId”])
at ideaic_interface_jira_create.pl line 62.
F:\ideaic\perl\site\lib>

“line 62: my $project = $jira->POST(’/project’, undef, {”

It looks like this is due to “leadAccountId”.
Where can I find the “leadAccountId” value?

Cheers,
Alex.

In my understanding, you’re targeting a Jira server deployment, hence, leadAccountId is not necessary. Kindly check Jira server’s Create project REST API.

Hi, lan
I tested with your help.
Attached image is a test source.


However, the following error occurs.
F:\ideaic\perl\site\lib>perl ideaic_interface_jira_create.pl
JIRA::REST Error[400 - Bad Request]:
-吏?뺥븳 ?꾨줈?앺듃 ?묒떇??議댁옱?섏? ?딆뒿?덈떎. ?대떦 ?꾨줈?앺듃 ?묒떇???ъ슜?먯쓽 Jira ?몄뒪?댁뒪?먯꽌 ?ъ슜???덈뒗吏 ?뺤씤?섏떗?쒖삤. ?꾩???꾩슂??寃쎌슦 ?ъ슜?먯쓽 Jira 愿由ъ옄?먭쾶 臾몄쓽?섏떗?쒖삤.
Jira 愿由ъ옄?먭쾶 臾몄쓽?섏떗?쒖삤.
at ideaic_interface_jira_create.pl line 64.
F:\ideaic\perl\site\lib>
“line 64” is “my project = jira-> POST (’/ project’, undef, {”
The reason is “my $ jira = JIRA :: REST → new ({” seems to be.
I have to use “JIRA :: REST”.
Can not I create a Jira Project using “JIRA :: REST”?
Cheer,
Alex.

I am not sure what the errors exactly mean, but my guess is that some values you used for IDs and schemes might be incorrect (it varies per instance so you need to get the correct ID). For testing purposes you can do away with commenting those out. I tried the code snippet below, commented out the IDs, and I was able to create a project successfully,

my $project = $jira->POST('/project', undef, {
	key => 'PERL2',
	name => 'Perl example two',
	projectTypeKey => 'business',
	projectTemplateKey => 'com.atlassian.jira-core-project-templates:jira-core-project-management',
    description => 'Example Project description',
    lead => 'admin',
    url => 'http://atlassian.com',
    assigneeType => 'PROJECT_LEAD',
#    avatarId => 10324,
#    issueSecurityScheme => 10001,
#    permissionScheme => 10011,
#    notificationScheme => 10021,
#    categoryId => 10120	

});

Do try it out and tell us how it goes.

Hi, lan
Thank you very much for your help.
Depending on your help, some sources have been modified and tested.
However, the same error occurred.
So I reset the "active code page" so that the log is not broken.
And I saw the log.
It means that the "designated project form" does not exist.
So I compared my source and the Atlassian document sample source.
There was a difference in the bottom part of the results.

projectTemplateKey => ‘com.atlassian.jira-core-project-templates:jira-core-simplified-project-management’,

    projectTemplateKey => 'com.atlassian.jira-core-project-templates:jira-core-project-management',

I modified and tested the other parts.
Wow! The test was successful.
The project has been created and the desired results have been confirmed.
Thank you very much. lan
When you come to Korea I would like to serve delicious food.
You are a wonderful person.
Cheers,
Alex.

You’re welcome, Alex. Glad to know you got it working now. Most, if not all, members of the developer community help each other out. Looking back, I’ve also got information here when I started out, so this is paying it forward :slight_smile:

Have a nice day.