Getting 400 Bad Request Error on POST when Creating Requests with REST API

I am having trouble calling a POST to create a request through the rest API. I can make GET requests just fine, but my POSTS aren’t working. I keep getting 400 Bad Request responses.

I am using {myURL}/rest/servicedeskapi/request as the source. POST as the method.

Can anyone see what’s wrong with my JSON body I’m passing through? Perhaps another set of eyes could catch what I cannot find.

  "serviceDeskId": "1",
  "requestTypeId": "63",
  "requestFieldValues": {
    "summary": "Test work order from Tiffanys web app",
    "description": "This is an automated test work order from Tiffanys web app",
    "priority": {"value": "10200"},
    "customfield_10124": {"value": "10109"},
    "customfield_10125": "Tiffanys Office"

Note: customfield_10124 and customfield_10125 are both single-select custom fields.

Thanks for any help!

@TiffanyOwen - if you drop one or both customfield_xxxxx fields from your POST request, does the request go through properly?

It does not… I’m guessing because those are required fields for that particular request type. However, I have finally gotten it to work. In the custom fields, I changed the “value” property text to “id” and it went through perfectly. Any idea why? The examples I pulled from the developer documentation looked like they had “value.” Thanks for the help!

Returning 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn’t follow the rules. The client SHOULD NOT repeat the request without modifications. It means that the request itself has somehow incorrect or corrupted and the server couldn’t understand it. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method . Therefore, it prevents the website from being properly displayed. To fix a 400 Bad Request error, it is best to start diagnosing the issue from the client side itself. Complete the steps outlined in this section to help diagnose and correct the error.

  • Check for errors in the URL.
  • Clear Browser Cache and cookies.
  • Clear DNS Cache.
  • Check your File upload Size.
  • Deactivate Browser Extensions.