Impossible to create request from API

Thomas Goossens April 4, 2024

Hello,

 

I am trying to create a service desk request from the API but i get the error and I can't find whats wrong. I tried much formats but nothing seems to work.

 

Error : 

"Impossible to create a request due to these errors: The field with id "customfield_10808" named "Maintenance type" contains these errors: Specify a valid 'id' or 'name' element for Maintenance type, \nThe field with id "priority" named "Priority" contains these errors: Specify the Priority (id or name) in string format

 

The Json I send : 

{
"requestFieldValues": {
"summary": "test",
"customfield_10808": "{\"name\":\"Minor repair\"}",
"customfield_10809": "{\"name\":\"Bureau stagiaires\"}",
"description": "test",
"priority": "{\"name\":\"Bloqueur\"}"
},
"requestTypeId": "248",
"serviceDeskId": "22"
}


I also tried with the id but same result. 

Endpoint is /rest/servicedeskapi/request.

 

Thanks

1 answer

1 accepted

1 vote
Answer accepted
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2024

HI @Thomas Goossens ,

I'm wondering about the custom fields. What type of fields are they?

(I'm guessing priority is the default system priority field :))

The values you are sending are they translated values (since they are in French) or ar they the only value on the field?

I would suggest to either send the id of the select value (I'm guessing they are select values) or the priority id, other than that try with the default system language (again guessing English)

Thomas Goossens April 4, 2024

HI, 

These a select fields and the values I send are values that i get directly from API ( "validValues").

Capture d’écran 2024-04-04 à 15.58.40.png

I didn't find more informations about these values like where to find the Id 

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2024

Normally the id should be listed there as the "value".

Can you try sending it with the "value" as the id?

You might be getting the translated values as you are most likely authenticating iwth your own account which the profile has as French?

Thomas Goossens April 4, 2024

I tried with the values as id like you suggested but i get same error, select fields are not recognized. 

 

{
"requestFieldValues": {
"summary": "test",
"customfield_10808": "{\"id\":\"10376\"}",
"customfield_10809": "{\"id\":\"222\"}",
"description": "test",
"priority": "{\"id\":\"1\"}"
},
"requestTypeId": "248",
"serviceDeskId": "22"
}


Yes i am logged in with a french account, but if i try to open request in web native interface, everything is in english except the values "label", they are saved in french in database. However both value and label are not recognized for Maintenance type witch is not translated. 

Thomas Goossens April 4, 2024

@Dirk Ronsmans I finally found that with the value and this syntax it works. Thanks !

{
"requestFieldValues": {
"summary": "test",
"customfield_10808": {"id" : "10376"},
"customfield_10809": "222",
"description": "test",
"priority": {"id":"1"}
},
"requestTypeId": "248",
"serviceDeskId": "22"
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events