Recent searches


No recent searches

Zendesk Api Integration



Posted Sep 14, 2022

Basically i installed a package name 'zendesk/zendesk_api_client_php' in my laravel application and using this package i want to make get request on tickets module in zendesk and access some tickets from zendesk api so for this purpose i also have enables password and APIToken and have added credentials in my app so when i make request from postman i got this error. Client error: `https://zendesk.com/api/v2/tickets.json` resulted in a `404 Not Found` response     can anyone plz suggest how to get rid of this error?


0

9

9 comments

Hi Ameer,

 

By the looks of it you are missing a subdomain, you cannot call https://zendesk.com directly, it needs to be a zendesk instance for example https://myzendesksubdomain.zendesk.com/api/v2/tickets would work fine providing your credentials are correct. 

0


Thanks Jack for your valuable suggestion but now i have also added subdomain correctly as well as other credentials like username and token but it giving now this error.                                                  Client error: `GET https://cloudrepia.zendesk.com/api/v2/tickets.json` resulted in a `401 Unauthorized` response:\n{\"error\":\"Couldn't authenticate you\"}\n [details] {\"error\":\"Couldn't authenticate you\"}"

0


That is a step in the right direction, your credentials need to be in this format:

email/token:token 

so as an example:

myemail@email.org/token:abc123apitoken

It also needs to be a base64 encoded string.

 

I hope this helps! 

0


can you please share any example or a reference so it would very beneficial for me?

0


Ah apologies I misread that you are using the php library, I think to set up credentials properly you want to have something like this:

 

use Zendesk\API\HttpClient as ZendeskAPI;

$subdomain = "subdomain";
$username  = "email@example.com"; // replace this with your registered email
$token     = "6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv"; // replace this with your token

$client = new ZendeskAPI($subdomain);
$client->setAuth('basic', ['username' => $username, 'token' => $token]);

You can find the full documentation for the library you are using here

0


yeah i am using php library and i am actually doing exact scenario as you mentioned above but still it is giving same authorization error.

0


I know it sounds silly but have you checked the API token and email combo you are using? Make sure to generate a new API token via the admin centre and copy / paste it to double check.

0


yeah jack i also have checked this too by the way thank you so much for your guidance let me see further how it can be sort out.

0


The user id should be <email id>/token

example - first.last@gmail.com/token

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post