Forums

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

Creating service-desk issues with an appropriate request-type using REST

Gray Watson December 11, 2023

I've read this question/answer but I'm still struggling with setting the request type on a new issue using the REST api.  When my users go to the portal, they choose a request type which takes them to the URL path like /servicedesk/customer/portal/8/create/111, where 8 is the portal number and 111 is the request-type.  This works fine.

I'm trying to drive this process using the REST API.  I'm creating issues via POST to

/rest/api/2/issue/ but when I try to set the request-type field, I get something like:

 

{"customfield_11200":"Field 'customfield_11200' cannot be set. It is not on the appropriate screen, or unknown."}

If I look at tickets that were created using the UI, I see that the request type seems to be customfield_11200 and that it has a form like:

{ "_links": { ... }, "requestType": { "id": "111", "name": "C++ Request", ... }

I've tried setting this customfield as well as the "requestType" field  with requestType as a subfield but I get the above error.

Questions:

  • I'm only specifying the id and name fields on the requestType so maybe I need all of the link and other fields?
  • Can anyone give me a sample JSON with a working request-type?
  • Do I need to use a different create URL which has the 111 in it?

 

Oh and I've not been able to find the request-type key via the API trying the following request which doesn't seem to work with my Jira instance:

/servicedesk/1/servicedesk/request/#####/request-types

Thanks for any help.
gray

1 answer

0 votes
Gray Watson December 11, 2023

I just figured this out. I was inappropriately using the "/rest/api/2/issue/" call when I should have been using the "/rest/servicedeskapi/request" which takes a JSON payload with 'serviceDeskId' and 'requestTypeId' fields.

Driving it through the service-desk API means that the workflow is used so the field validations and various automations are performed so I should have been doing it this way from the start although some of the workflow rules were firing using the issue API.

I also figured out the right way to lookup the request-ids:

/rest/servicedeskapi/servicedesk/#/requesttype

There may be some way to create service-desk tickets through the issue API with a correct request-id but I couldn't figure it out so I'm glad that this seems to be working.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events