Error (422 Response) when posting a request using the requests.json API as an End-User


10 コメント

  • Calum Ochkas

    Found the issue. For others: creating ticket requests as the end user you must pass basic auth and the emailaddress\token.

    'method': 'post',
    'payload' : JSON.stringify(formData),
    'contentType' : 'application/json',
    'headers' : {"Authorization" : "Basic " oauthemail + "/" + token}

  • Bryan Flynn

    Hi Calum -- just to clarify, a new request/ticket created by an end user using an OAuth/Bearer token should work.

    To simplify the above and using the cURL command line tool, the request would look something like:

    curl -v -H "Content-Type: application/json" -H "Authorization: Bearer d482cccebdd482cccebdd482cccebdd482cccebdd482cccebdd482cccebd" -X POST -d '{"request":{"subject":"Test Ticket Subject","comment":{"body":"Test Ticket Body"}}}'

    You can quickly generate an OAuth token for the above example using your own account and end-user by:

    1. In an incognito browser window, go to

    2. Enter your Zendesk instance's subodomain

    3. Click Authorize (then select 'Allow' in the popup window that's displayed if needed)

    4. Then copy the entire returned OAuth token

    I would not recommend using the "API Token"/Basic authorization approach from a client-side solution -- it exposes your account to possible abuse. By switching out the email address before the "/token" portion, you can impersonate other users. You should only use an API token within the context of a secure server-side solution (one that will not expose the API token to any client agents).

  • Calum Ochkas

    The way you mention is how I've done it when able to encrypt the token somewhere. However, I'm building scripts into the Google Apps Script API. Ideally I don't want to be publishing any API Token plain text on the Apps Script console, hence I'm initiating the OAuth Token request and retrieving the token in a variable - saving any token being published on the script itself


  • Bryan Flynn

    That sounds reasonable Calum. So I'll just point out again then, an end-user account can generate an OAuth token and use it against the /api/v2/requests.json API. It sounded like this wasn't working for you when I read the original post. If that's still the case, then more details will probably be needed via a private ticket. Let me know and I can create one for you.

  • Calum Ochkas

    Thanks Bryan. If you'd like to see the Auth fail without basic auth I'm happy to show you via a private ticket. Let me know, else I'm happy with the workaround for now.

  • Rahul Maurya

    I am getting the same error code.

    While sending it through a mobile app, I am getting 422 error code without any error message details whereas if I am using the same auth token, request body in postman. It gets succeeded.
    Please help


    {"request":{"subject":"test 1","from_mail":"","comment":{"body":"testy 1"}}}


    Content-Type: application/json

    Authorization: Basic email+token



  • Devan La Spisa
    Zendesk Community Manager

    Hello @...,

    It looks like you might be experiencing a bug, I've gone ahead and opened a ticket for you so one of our experts can dive deeper into this issue. You should expect a response from one of our skilled Advocates soon, and we appreciate your patience with this issue.

    Best regards.

  • Austin Vieth

    I have the exact same issue as Rahul except I'm using the Oauth flow.


    I will be opening a private ticket.

  • karan sharma

    i have issue related to this 

    "error": "RecordInvalid",
    "description": "Record validation errors",
    "details": {
    "requester": [
    "description": "Requester: Name: is too short (minimum one character)"

    we have a webhook created which is creating parent to child ticket via webhook and one of the fields in parent ticket becomes requester for child ticket.can i get any idea over it?

  • Christopher Kennedy
    Zendesk Developer Advocacy
    Hi Karan,
    When creating a ticket with a new requester, both the requester email and name are required.  Update the JSON body in your trigger to include the requester name as noted in the linked doc. This will resolve that record validation error you're seeing.


Powered by Zendesk