Forums

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

Create issue with customfield - which params are required?

maciej.wicher
Contributor
March 3, 2020

I've got a project board where required fields to create an issue are issueType and description, like below:

 "fields": {
"summary": "Remote test with request type",
"issuetype": {
"id": "12542"
},
"project": {
"key": "Test"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Second remote test",
"type": "text"
}
]
}
]

The thing is I need to create this issue with custom field which represents Customer Request Type. As far I can see it's customfield_10029 which with above code is set as nil - "customfield_10029"=>nil.

If I change this Customer Request Type manually (in ticket details view there is a drop-down list) to Add Colaborator / Team Member like in a screen:

https://monosnap.com/file/S6UPBOO0PZhpnX39wRk1CIQ521sSRH

 

The customfield_10029 will changed to:

"customfield_10029":
    {"_links": {"jiraRest": "https://company_name.atlassian.net/rest/api/2/issue/241495", "web": "https://company_name.atlassian.net/servicedesk/customer/portal/19/Test-11", "self": "https://company_name.atlassian.net/rest/servicedeskapi/request/241495"},
"requestType":
{"_expands": ["field"],
"id": "358",
"_links": {"self": "https://company_name.atlassian.net/rest/servicedeskapi/servicedesk/19/requesttype/358"},
"name": "Add Colaborator / Team Member",
"description": "e.g. external dev",
"helpText": "you can find github nicks down here https://github.com/some_url",
"issueTypeId": "12542",
"serviceDeskId": "19",
"groupIds": ["70"],
"icon":
{"id": "19558",
"_links":
{"iconUrls":
{"48x48": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=large",
"24x24": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=small",
"16x16": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=xsmall",
"32x32": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=medium"}}}}
}

The question is how to setup an issue with this custom field? is there any way to check which of field inside of this custom field are required?

I was trying to use curl to create it by:

curl --request POST \
--url 'https://company_name.atlassian.net/rest/api/3/issue' \
--user 'user:token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{

          "fields": { DATA FROM MY FIRST CODE BLOCK

              "customfield_10029": DATA FROM SECOND CODE BLOCK

               }

            }'

But I'm getting an error:

{"errorMessages":["Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.catalina.connector.CoyoteInputStream@2e2743e7; line: 1, column: 0])\n at [Source: org.apache.catalina.connector.CoyoteInputStream@2e2743e7; line: 46, column: 1863]"]}

 

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

Hi @maciej.wicher ,

The Customer Request is a Field specific to Jira Service Desk and is going to require a different approach to create a Service Desk customer request over a standard Jira issue type used in Core or Software as the project types use different methods to route the issues.

Check out the Jira Service Desk API documentation under the section "Create customer request" with the EXE JSON being:

curl --request POST \
  --url 'https://your-domain.atlassian.net/rest/servicedeskapi/request' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "requestParticipants": [
    "qm:a713c8ea-1075-4e30-9d96-891a7d181739:5ad6d69abfa3980ce712caae"
  ],
  "serviceDeskId": "10",
  "requestTypeId": "25",
  "requestFieldValues": {
    "summary": "Request JSD help via REST",
    "description": "I need a new *mouse* for my Mac"
  }
}'

As noted in the documentation you will do a POST to /rest/servicedeskapi/request including the Request type custom field value as well as any other required field, to get the required field values and formatting it notes:

The JSON request must include the service desk and customer request type, as well as any fields that are required for the request type. A list of the fields required by a customer request type can be obtained using servicedesk/{serviceDeskId}/requesttype/{requestTypeId}/field.

Regards,
Earl

Suggest an answer

Log in or Sign up to answer