Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,720
Community Members
 
Community Events
168
Community Groups

Setting Customer Request Type to an issue when creating it via REST API

Dear Atlassian community,

I would like to ask you if there is a way to set the CRT of an issue when creating it via REST API on the Cloud platform. I read some articles but none of them were helpful. From my testing, all I get is:

Screenshot_11.png

I tried with ID, I tried with name but I get the same result. The field is included in the create issue screen. I would be very happy if you could give me some advice :) 

Best regards,
Nadezhda Hristova

1 answer

1 accepted

0 votes
Answer accepted
Dirk Ronsmans Community Leader Aug 29, 2022

Hey Dirk,

Thank you very much for the fast response. Everything looks nicely explained but I just have trouble with this API call:

rest/servicedesk/1/servicedesk/request/ISSUE_ID/request-types

I put it as it is but I also tried with the service desk portal id, issue key and so on. I did not have success - I get the 404 error.

Is it possible to explain it in a bit more detailed manner? I would be very thankful :) 

 

Best regards,
Nadezhda Hristova

Hey @Nadezhda Hristova ,

to use that endpoint you need to use the issueID and not the issue key.

In the related Cloud issue (https://jira.atlassian.com/browse/JSDCLOUD-4917) it is actually mentioned by one of the comments.

 

Note that's it'sissue id(eg. 123456) and notissue key(eg. SDA-123) - might be why you're getting 404.
When requesting that endpoint, the value of the customfield is the combination ofportalKeyandkeyfor the customer request type that you want:portalKey/key. So in the example given in the workaround articles, the response tohttps://YOUR_HOSTNAME/rest/servicedesk/1/servicedesk/request/ISSUE_ID/request-typeswould have been something like:

{
  { "validRequestTypes": [
     { 
        "id": 123, 
        "cvId": 12, 
        "portalKey": "sda", 
        "portalId": 10, 
        "key": "getithelp",
        [...]
     },
     [...]
  ]}

And therefore the value would besda/getithelp

 

You can find an issue id by requesting /rest/api/3/issue/<issue-key>.

https://jira.atlassian.com/browse/JSDCLOUD-4917?focusedCommentId=2490016&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2490016

 

So you'll first have to call the /rest/api/3/issue/<issue-key> endpoint to get the issue key and then use the issueid to go on to the next step

I got it the right way this time. Thank you, Dirk!

And since I am here on the topic of REST API, could you tell me if there is a way to get the id of this button and its options in the portal:

Screenshot_15.png

Dirk Ronsmans Community Leader Sep 01, 2022

I'm not sure that might be possible.

What would your use-case be for these?

A team of ours is making integration with another platform and they were thinking of adding those, if possible.

Dirk Ronsmans Community Leader Sep 01, 2022

I think you'd need to look more at what functionality they want and work from there.

The dropdown that you see are actually just filters for the tickets so in the background they would just be using a JQL meaning those filters could be re-created using your own filtering.

A good start might be the JQL documentation for the REST API

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events