AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
321 stars 131 forks source link

Get-JiraIssueCreateMetadata returns "No projects were found for the given project. Use Get-JiraProject for more details." #455

Open ghost opened 2 years ago

ghost commented 2 years ago

Get-JiraIssueCreateMetadata -Project 'DAT' -IssueType 'Bug' -Credential $Cred -ErrorAction Stop -Debug:$false returns Get-JiraIssueCreateMetadata: No projects were found for the given project [DAT]. Use Get-JiraProject for more details. But Get-JiraProject -Project DAT returns Name : DATEST RestUrl : https://jira.eislan.net/rest/api/2/project/11144 Style : IssueTypes : {Task, Sub-task, Bug, Story} Key : DAT Components : {} Description : ID : 11144 Category : Roles : @{Developers=https://jira.eislan.net/rest/api/2/project/11144/role/10001; Support=https://jira.eislan.net/rest/api/2/project/11144/role/10011; Administrators=https://jira.eislan.net/rest/api/2/project/11144/role/10002; Users=https://jira.eislan.net/rest/api/2/project/11144/role/10000} Lead : dalbert

So, the project and the issue type exist. I put a breakpoint on $webResponse = Invoke-WebRequest @splatParameters line in the Invoke-JiraMethod function. $splatParameters

Name Value Credential System.Management.Automation.PSCredential AllowUnencryptedAuthentication True Uri http://jira.eislan.net/rest/api/2/issue/createmeta?issuetypeIds=1&maxResults=25&projectIds=11144&expand=projects.issuetypes.fields ContentType application/json; charset=utf-8 Headers {Accept, Accept-Charset} Verbose False ErrorAction Stop Method Get UseBasicParsing True

when I run Invoke-WebRequest 'http://jira.eislan.net/rest/api/2/issue/createmeta?issuetypeIds=1&maxResults=25&projectIds=11144&expand=projects.issuetypes.fields' it returns StatusCode : 200 StatusDescription : OK Content : {"expand":"projects","projects":[]} RawContent : HTTP/1.1 200 OK Server: nginx Date: Thu, 26 May 2022 15:08:42 GMT Transfer-Encoding: chunked Connection: keep-alive X-AREQUESTID: 668x12023758x1 X-XSS-Protection: 1; mode=block X-Content-Type-O… Headers : {[Server, System.String[]], [Date, System.String[]], [Transfer-Encoding, System.String[]], [Connection, System.String[]]…} Images : {} InputFields : {} Links : {} RawContentLength : 35 RelationLink : {}

I want to emphasize the output of: Content : {"expand":"projects","projects":[]} - "projects" is empty!

But when I put the Uri from the $splatParameters into the web browser that logged into the my Jira, it returns projects: { "expand": "projects", "projects": [ { "expand": "issuetypes", "self": "https://jira.eislan.net/rest/api/2/project/11144", "id": "11144", "key": "DAT", "name": "DATEST", "avatarUrls": { "48x48": "https://jira.eislan.net/secure/projectavatar?avatarId=11603", "24x24": "https://jira.eislan.net/secure/projectavatar?size=small&avatarId=11603", "16x16": "https://jira.eislan.net/secure/projectavatar?size=xsmall&avatarId=11603", "32x32": "https://jira.eislan.net/secure/projectavatar?size=medium&avatarId=11603" }, "issuetypes": [ { "self": "https://jira.eislan.net/rest/api/2/issuetype/1", "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "iconUrl": "https://jira.eislan.net/secure/viewavatar?size=xsmall&avatarId=11303&avatarType=issuetype", "name": "Bug", "subtask": false, "expand": "fields", "fields": { "summary": { "required": true, "schema": { "type": "string", "system": "summary" }, "name": "Summary", "fieldId": "summary", "hasDefaultValue": false, "operations": [ "set" ] }, "issuetype": { "required": true, "schema": { "type": "issuetype", "system": "issuetype" }, "name": "Issue Type", "fieldId": "issuetype", "hasDefaultValue": false, "operations": [], "allowedValues": [ { "self": "https://jira.eislan.net/rest/api/2/issuetype/1", "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "iconUrl": "https://jira.eislan.net/secure/viewavatar?size=xsmall&avatarId=11303&avatarType=issuetype", "name": "Bug", "subtask": false, "avatarId": 11303 } ] }, "reporter": { "required": true, "schema": { "type": "user", "system": "reporter" }, "name": "Reporter", "fieldId": "reporter", "autoCompleteUrl": "https://jira.eislan.net/rest/api/latest/user/search?username=", "hasDefaultValue": false, "operations": [ "set" ] }, "attachment": { "required": false, "schema": { "type": "array", "items": "attachment", "system": "attachment" }, "name": "Attachment", "fieldId": "attachment", "hasDefaultValue": false, "operations": [] }, "duedate": { "required": false, "schema": { "type": "date", "system": "duedate" }, "name": "Due Date", "fieldId": "duedate", "hasDefaultValue": false, "operations": [ "set" ] }, "description": { "required": false, "schema": { "type": "string", "system": "description" }, "name": "Description", "fieldId": "description", "hasDefaultValue": false, "operations": [ "set" ] }, "priority": { "required": false, "schema": { "type": "priority", "system": "priority" }, "name": "Priority", "fieldId": "priority", "hasDefaultValue": true, "operations": [ "set" ], "allowedValues": [ { "self": "https://jira.eislan.net/rest/api/2/priority/1", "iconUrl": "https://jira.eislan.net/images/icons/priorities/blocker.svg", "name": "Blocker", "id": "1" }, { "self": "https://jira.eislan.net/rest/api/2/priority/2", "iconUrl": "https://jira.eislan.net/images/icons/priorities/critical.svg", "name": "Critical", "id": "2" }, { "self": "https://jira.eislan.net/rest/api/2/priority/3", "iconUrl": "https://jira.eislan.net/images/icons/priorities/major.svg", "name": "Major", "id": "3" }, { "self": "https://jira.eislan.net/rest/api/2/priority/4", "iconUrl": "https://jira.eislan.net/images/icons/priorities/minor.svg", "name": "Minor", "id": "4" }, { "self": "https://jira.eislan.net/rest/api/2/priority/5", "iconUrl": "https://jira.eislan.net/images/icons/priorities/trivial.svg", "name": "Trivial", "id": "5" }, { "self": "https://jira.eislan.net/rest/api/2/priority/6", "iconUrl": "https://jira.eislan.net/images/icons/ico_epic.png", "name": "Future", "id": "6" } ], "defaultValue": { "self": "https://jira.eislan.net/rest/api/2/priority/3", "iconUrl": "https://jira.eislan.net/images/icons/priorities/major.svg", "name": "Major", "id": "3" } }, "labels": { "required": false, "schema": { "type": "array", "items": "string", "system": "labels" }, "name": "Labels", "fieldId": "labels", "autoCompleteUrl": "https://jira.eislan.net/rest/api/1.0/labels/suggest?query=", "hasDefaultValue": false, "operations": [ "add", "set", "remove" ] }, "assignee": { "required": false, "schema": { "type": "user", "system": "assignee" }, "name": "Assignee", "fieldId": "assignee", "autoCompleteUrl": "https://jira.eislan.net/rest/api/latest/user/assignable/search?issueKey=null&username=", "hasDefaultValue": false, "operations": [ "set" ] }, "project": { "required": true, "schema": { "type": "project", "system": "project" }, "name": "Project", "fieldId": "project", "hasDefaultValue": false, "operations": [ "set" ], "allowedValues": [ { "self": "https://jira.eislan.net/rest/api/2/project/11144", "id": "11144", "key": "DAT", "name": "DATEST", "projectTypeKey": "business", "avatarUrls": { "48x48": "https://jira.eislan.net/secure/projectavatar?avatarId=11603", "24x24": "https://jira.eislan.net/secure/projectavatar?size=small&avatarId=11603", "16x16": "https://jira.eislan.net/secure/projectavatar?size=xsmall&avatarId=11603", "32x32": "https://jira.eislan.net/secure/projectavatar?size=medium&avatarId=11603" } } ] } } } ] } ] }

Please help to resolve this. Thank you, David Albert.