Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jiraps New-jiraissue -subtask

Diego Toniolo March 29, 2022

Sorry for the question,but i'm losing myself into the web; i'm trying to create script to create subtask on existing story with

New-JiraIssue -IssueType "sub-task" -Parent "ITRS-9786" -Project "ITRS" -Summary "test" -Verbose -Credential $cred

but it fails with 

No metadata found for project ITRS and issueType sub-task

What is wrong?

Regards

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2022

Welcome to the Atlassian Community!

What script language or library are you using there?

How are you getting the API token and using it to log in?  I ask because a "no metadata found" error is either

  • what it immediately suggests (you don't have a project called ITRS) 
  • your credentials are not letting you in as a user that can see and create issues in ITRS
  • your credentials are not letting you in at all
Diego Toniolo March 30, 2022

Hi Nic, thank you for your reply

I'm using ps 5.1 and the module is the last one available installing following official guide

 

The Project "ITRS" was choose using the attribute Key given from comand

Get-Jiraproject -Credential $cred

 

Via web interface I can create sub-task on Story "ITRS-9786"

Diego Toniolo March 30, 2022

PS C:\Windows\System32\WindowsPowerShell\v1.0> New-JiraIssue -IssueType sub-task -Parent ITRS-9786 -Project ITRS -Summary "test" -Verbose -Credential $cred
DETTAGLIATO: [New-JiraIssue] Function started
DETTAGLIATO: [Get-JiraConfigServer] Function started
DETTAGLIATO: [Get-JiraConfigServer] Complete
DETTAGLIATO: [Get-JiraIssueCreateMetadata] Function started
DETTAGLIATO: [Get-JiraConfigServer] Function started
DETTAGLIATO: [Get-JiraConfigServer] Complete
DETTAGLIATO: [Get-JiraProject] Function started
DETTAGLIATO: [Get-JiraConfigServer] Function started
DETTAGLIATO: [Get-JiraConfigServer] Complete
DETTAGLIATO: [Get-JiraProject] Processing [ITRS]
DETTAGLIATO: [Invoke-JiraMethod] Function started
DETTAGLIATO: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
DETTAGLIATO:
Name Value
---- -----
expand description,lead,issueTypes,url,projectKeys
maxResults 25

 

DETTAGLIATO: [Invoke-JiraMethod] Get http://jira.i***/rest/api/2/project/ITRS?expand=description,lead,issueTypes,url,projectKeys&maxResults=25
DETTAGLIATO: [Test-ServerResponse] Checking response headers for authentication errors
DETTAGLIATO: [Invoke-JiraMethod] Status code: 200
DETTAGLIATO: [Invoke-JiraMethod] Function ended
DETTAGLIATO: [Get-JiraProject] Complete
DETTAGLIATO: [Invoke-JiraMethod] Function started
DETTAGLIATO: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
DETTAGLIATO:
Name Value
---- -----
issuetypeIds 10101
maxResults 25
expand projects.issuetypes.fields
projectIds 10604

 

DETTAGLIATO: [Invoke-JiraMethod] Get http://jira.***/rest/api/2/issue/createmeta?issuetypeIds=10101&maxResults=25&expand=projects.issuetypes.fields&projectIds=10604
DETTAGLIATO: [Invoke-JiraMethod] Failed to get an answer from the server
DETTAGLIATO: [Test-ServerResponse] Checking response headers for authentication errors
DETTAGLIATO: [Invoke-JiraMethod] Status code: InternalServerError
DETTAGLIATO: [Resolve-ErrorWebResponse] Function started
DETTAGLIATO: [Resolve-ErrorWebResponse] Retrieved body of HTTP response for more information about the error ($responseBody)
DETTAGLIATO: [Resolve-ErrorWebResponse] Function ended
DETTAGLIATO: [Invoke-JiraMethod] Function ended
No metadata found for project ITRS and issueType sub-task.
In C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.14.6\JiraPS.psm1:2058 car:13
+ Throw $errorItem
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ITRS:String) [], ArgumentException
+ FullyQualifiedErrorId : IssueMetadata.ObjectNotFound

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2022

That doesn't tell us what the library is, but the logs seem to say you got in ok, ran a search and found nothing.  Your user can't see the project basically.  The code is calling a "createmeta" function which essentially says "Tell me what data you need to create an issue in this project" and the response is "you can't see that"

Diego Toniolo March 31, 2022

Sorry, but i don't understand what you mean with library?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2022

What is providing the New-JiraIssue command you are running here?  It uses a library to access Jira somehow

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events