It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Setting the Requst Type of a newly created Issue via remote API Edited

I have been able to successfully create an issue using the REST api (rails gem) on my JIRA Service Desk instance (cloud).  I have also been successful in setting the reporter, but I have noticed that although the customer has been set, the issue does not show up on the customer's request list.  I readily figured out that the problem is that the request type was not being set.

 

The project that I am using has the issue type mapped to a specific request type.  Furthermore, the Request Type field has been added to the create issue screen.  In addition, I have manually set another issue to include the appropriate request type, and determined the request type field to be 'customfield_10047'.  

 

With all this said, I have been very unsuccessful in setting the Request Type during creation.  The first semi-sucessful attempt resulted in the following error:

 

errors:

    customfield_10047: Operation value must be a string

 

 

This occurred when I was passing more complex information about the request type (so as to mirror an existing issue).

After this, the closest I managed to getting a semi-valid response is when the server was when using a pure string.  In this case, the server responded with:

 

errors:

    customfield_10047: Invalid customer request value

 

 

I've tried setting the string value to the id of the request type "97", and I've also tried setting it to the exact string value of the Request Type, namely "Purchase Request", but no matter what I enter, I get an error.

 

Any ideas on how this value can be set appropriately?

 

3 answers

1 accepted

4 votes
Answer accepted
Dario Atlassian Team Jul 02, 2019

Hi @Peter Androutsos ,

It  took a bit of research and testing but I am happy to say I managed to make this work in Jira Cloud as well. Also, I am adding this as a new answer so that if you like it you can accept it as the solution for this question.

The way to achieve what you are asking for is actually explained in below KB for Jira Server:

 

However, since in Cloud you do not have access to the Database, you cannot get the request type KEY from the  AO_54307E_VIEWPORTFORM table as explained in above KB, but you will have to use the following REST API endpoint instead:

  • https://YOUR_HOSTNAME/rest/servicedesk/SERVICE_DESK/servicedesk/request/ISSUE/request-types

Calling to the above endpoint (or pasting it in the browser) with a correct issue ID and the correct service desk ID for the associated issue will result in JIRA returning a JSON response containing all customer request types within the service desk, including the Key.

 

Please notice that this is an internal endpoint not officially documented that can change without prior notice. Indeed we have the below Feature request opened in our system to have the official REST API endpoint to include the request-type key to which I have just added the workaround:

 

You may want to vote and watch the above feature request so that you will get notified in case of any update. The  feature will be addressed according to the Implementation of New Features Policy.

 

Let me know if this helps.

 

Cheers,
Dario

This is helpful.  I will explore these options and endpoints.

Like Dario likes this

Agreed - helpful.

Like Dario likes this
Dario Atlassian Team Aug 20, 2019

Thanks for letting me know @Linwood Ma ! :) 

Also, just FYI, I have summarized everything in the below KB article:

 

Cheers,
Dario

0 votes
Dario Atlassian Team Jun 28, 2019

Hi @Peter Androutsos ,

In order to create a valid customer request in Jira Service Desk Cloud you may want to use the Jira Service Desk REST API endpoint /rest/servicedeskapi/request instead of the Jira Core Rest API endpoint /rest/api/2/issue (or /rest/api/3/issue).

 

For further details please see:

I hope this helps.

 

Have a nice weekend.

 

Cheers,
Dario

Thanks.  I've since added some automation in the project which provides a workaround to this, but I will investigate trying to do this the other way around regardless.  With that said, I am curious as to why the option to set the request type exists on the regular issue-generating api, but won't accept any value.  Are there specifics to what values can be set for this parameter?

Dario Atlassian Team Jul 03, 2019

@Peter Androutsos ,

The actual problem is not that it does not accept any value, but that the value you are supposed to enter in there is not documented and not exposed by public APIs. For this I have added an howto/workaround yesterday.

However, can you kindly let us know the use case for which you need to call the Jira Core REST API endpoint to create the issue and you cannot use the Servicedesk ones, so that I can forward this feedback to the Jira Service Desk team?  

 

Thanks,
Dario

Hi @Dario ,

I tried to follow your guide but i am still unable to get the Customer Request Type field's allowed value list.

I am working on Jira Cloud and i am trying to create a ticket using Google Scripting and trying to Populate the Customer Request Type field with an existing category 'Testing & Management' and my script returns "customfield_10800":"Invalid customer request value" error.

 

My project key is "Test" and i tried using the endpoint "rest/servicedesk/SERVICE_DESK/servicedesk/request/ISSUE/request-types" but it doesn't display anything on the screen.

 

Any help is highly appreciated.

@Dario , i get a 404 when trying to access the below endpoint.

Service-Desk ID: 2

Issue-Id: 10201


/rest/servicedesk/2/servicedesk/request/10201/request-types

Is there any other way to view the Key?

@harsh kanukuntla ,

The endpoint seem to have changed and now it is: 

  • https://YOUR_HOSTNAME/rest/servicedesk/1/servicedesk/request/ISSUE_ID/request-types

 

Also, the below KB has been updated in order to reflect the change:

 

However, please once again notice that you should be using the Jira Service Desk Cloud REST API /rest/servicedeskapi/request instead of the Jira Core Cloud REST API endpoint  /rest/api/2/issue:

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

363 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you