401 unauthorised for POST /api/v2/requests



Posted May 28, 2023

I'm running a static site seperate to my zendesk account in which we are trying to create anonymous tickets.

I'm using a Cloudflare worker to send these requests and per the docs, I'm calling the https://<mydomain>.zendesk.com/api/v2/requests url which shouldn't need any authentication from my understanding according to these docs:

https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/

I'm also sending the Bearer token header from a generated API token (confirmed correct).

I keep encountering a 401 Unauthorized error when sending a payload, even the payload specified in the docs:

{"request": {"requester": {"name": "Anonymous customer"}, "subject": "Help!", "comment": {"body": "My printer is on fire!" }}}

If I send NO payload, I get a 200 OK status, which suggests the data is maybe malformed but I've tried various versions of this. 

I thought it may be a CORS issue but I've set it to both the domain I'm sending to and to allow all ("*") for testing and still can't create an anonymous ticket from a different domain. 


Any help would be appreciated.


0

2

2 comments

Hi James! I see that you had a ticket open for this issue and from what I can tell, everything appears to be resolved now. If that's not correct, let me know what you're stuck on!

0


Hi Ahmed,

My settings are Enabled for 'Anybody can submit tickets'

Thanks for that, I tried the Basic authentication and base64 encoded the following structure:

jdoe@example.com/token:[REDACTED BY ZENDESK]

and have also tried without token (just {email}/{password} encoded)

I'm sending a payload such as:

{
      "request": {
        "requester": {"name": "Anonymous customer", "email": "james@test.com"},
        "subject": "Help!",
        "comment": {"body": "My printer is on fire!" }
      }
    }

And now receive a 422 Unprocessable Entity.


 

0


Sign in to leave a comment.

Didn't find what you're looking for?

New post