Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Not able to set Request type as part of create issue Rest API

DiLiP November 23, 2020

Hi All....  I stumbled into an Issue when I started to explore Create Issue rest API

Usecase : I need to create an Issue in with Request Type value

With lots of search over the internet, I was finally got to know that, to set the value for Request Type field, the value should be in the format Projectkey/requestTypename

In my case, the Request field Id is : customfield_10010 (First I tried create the Issue in UI by setting the Request value and then did a getIssue API call to find the customefield value) 

I have created some testing Request types and mapped it to the proper Issue type which Im setting during create Issue.

Following is the request Im triggering from postman

{ "fields": { "summary": "Ticket With Request Type", "customfield_10039": "SUBS_001", "issuetype": { "id": "10001", "name":"Submit a request or incident" }, "customfield_10040": "TICKET_001", "customfield_10010":"ob/Custom_Req_Type_001", "project": { "id": "10000" }, "description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "We are Setting the request type while creating ticket", "type": "text" } ] } ] } }}

 

I have highlighted the custom field in the above request which is value for Request Type.

 

After I triggered the API, I got the Success response with id, Key and self

Now When Open the Issue in Jira, the field Request type is not set with any value. Please take a look at the following screenshot for highlighted section

NoRequestType.png

 

Now If I Edit the field Request Type then I'm able to see the drop-down values which is having the same which I sent in the request. Please take look at the following screenshot for highlighted section 

EditRequestType.png

 

Is there anything I'm missing here like any setting or permission or Is there any different way using which I can set the value for the field Request Type


Thanks In Advance

 

1 answer

1 accepted

0 votes
Answer accepted
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 24, 2020

Hello @DiLiP,

Welcome to Atlassian Community!

Thank you for sharing all the details and screenshots of the issue.

When using Jira, there are different REST APIs for Service Management, Software, and Business projects and I can see that you are using the API to create an issue for Software/Bussiness projects.

The API to create a request in Service Management is different because it's the only type of project that contains fields such as request types and request participants. 

Please, use the endpoint below:

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"
  }
}'

If you face any issues or have any other questions, please let us know. 

Regards,
Angélica

DiLiP November 30, 2020

Hi Angelica

Thank you So much for you response. The provided information very helpful.

Just one more question may be not related to this thread but Just wanted to know...

I wanted to assign or add Watchers to an issue from the external system. With all the User APIs, I got to know that, we have to pass the user accountId.... Is there any API where I can get the user AccountID by passing the username or so... 


Thanks for your Time

Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2020

Hello @DiLiP,

I'm glad that I could help!

In order to get their accountID, you can use the "Find users and groups" API:

curl --request GET \
--url 'https://domain.atlassian.net/rest/api/3/groupuserpicker?query=user@domain.com' \
--user 'admin@domain.com:A1b2345CdEfgHIJkLMn67O8Q' \
--header 'Accept: application/json'

There is a second option that you can use the REST API call below directly in the browser:

https://domain.atlassian.net/rest/api/latest/user/search?query=user@domain.com

Hope this helps!

Suggest an answer

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

Atlassian Community Events