Create Request - Custom Fields not working | Community
Skip to main content

Create Request - Custom Fields not working

  • November 10, 2017
  • 2 replies
  • 0 views

Hi, 

when i try to create a new request using the `create request api`. It seems i can't fill in the custom fields:

curl https://{host}/api/v2/requests.json \
-d '{"request": {"subject": "Help!", "custom_fields": [{"id": 26948671, "value": "test category"}], "comment": {"body": "My printer is on fire!" }}}' \
-v -u {email}/token:{token} -X POST -H "Content-Type: application/json"

Response:

{"error":"RecordInvalid","description":"Record validation errors","details":{"base":[{"description":"Category: cannot be blank","error":"BlankValue","field_key":26948671}}]}}

Any Advice how to solve this is appreciated.

kind Regards

This topic has been closed for replies.

2 replies

Nicole17
  • November 17, 2017

Hey Florian - 

Since no one from the community has jumped in at this point, I've asked one of our Customer Advocates to join the conversation. Someone should be along shortly to help out!

 


  • November 19, 2017

Hi Florian - 

It looks like your payload format may be different than what we're expecting. I did some testing in my test account and the following worked for me, successfully filling in a drop down field's value: 

{
 "request": {
  "requester": {
      "name": "Customer"
  },
  "subject": "Help!",
  "comment": {
      "body": "My printer is on fire!"
  },
  "custom_fields": [{
      "id": 32059818,
      "value": "football"
  }]
 }
}

And a payload for two custom fields, one a drop down and another a text field: 

{
 "request": {
  "requester": {
      "name": "Custom Fields"
  },
  "subject": "Help!",
  "comment": {
      "body": "My printer is on fire!"
  },
  "custom_fields": [{
      "id": 32059818,
      "value": "football"
  }, {
      "id": 32175007,
      "value": "Text Field"
  }]
 }
}

Here's my full curl request: 

curl https://subdomain.zendesk.com/api/v2/requests.json -d '{"request": {"requester": {"name": "Customer"}, "subject": "Help!", "comment": {"body": "My printer is on fire!" }, "custom_fields": [{ "id": 32059818, "value": "football" }]}}'  -X POST -H "Content-Type: application/json"

Hope this helps!