Type/Priority/Custom fields not set when creating request

Beantwortet

5 Kommentare

  • CJ

    This endpoint is a real pain about not telling you when things aren't formatted the way it needs. You will need to add quotes to a lot of places to get this to work, and change some of your single quotes, to doubles. Try this: 

    {
    "request":{
        "type": "incident",
        "priority": "high",
        "requester":{"name":"John Doe","email":"john.doe@email.com"},
        "subject": "Something bad happened!",
        "comment":{
            "body": "Can you look into this?",
            },
        "custom_fields": [
            { "id": "8296782846740", "value": "custom 1"},
            { "id": "8296695964692", "value": "custom 2"},
        ]
    }

    To figure out if you have syntax issues, I recommend the free products Sublime, or Visual Studio, which let you paste in code, and tell it what flavor it is, and then it highlights any problems: 

    Additionally, Postman, a GUI interface for interacting with APIs, has a built in syntax checker that has helped me find stray commas and the like before I send, all the time.  That can make it a little quicker/easier to deal with the API returning a syntax error, because the sending/checking/receiving it all in the same window: 

    0
  • Jared Petchell

    CJ Thanks for the reply!
    Sorry, I should have clarified, this is a Javascript object that's converted to JSON eventually by our request handler (hence no quotes on keys; single quotes are just the codebase style)
    This is the JSON data being sent out:

    {
      "request": {
        "type": "incident",
        "priority": "high",
        "custom_fields": [
          {
            "id": 8296782846740,
            "value": "custom 1"
          },
          {
            "id": 8296695964692,
            "value": "custom 2'"
          }
        ],
        "requester": {
          "name": "John Doe",
          "email": "john.doe@email.com"
        },
        "subject": "Something bad happened!",
        "comment": {
          "body": "Can you look into this?"
        }
      }
    }
    0
  • Ahmed Zaid

    Hi Jared Petchell,

    Perhaps check from admin center or ticket fields end point if those fields are editable by end users?

    2
  • Jared Petchell

    Ahmed Zaid
    That was it! Those fields populate correctly now. Thanks!
    We don't want these custom fields showing up to the user when submitting a request though, so I'll look into other ways of adding the info (possible adding an internal note)

    0
  • Ahmed Zaid

    Jared Petchell,

    Glad it worked. I believe if you remove the fields from the ticket form you can still populate them without exposing them to the end user. However, they will not be visible to agents. My ideal solution would be populating those fields with a trigger after request is created instead.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk