Giter Site home page Giter Site logo

Comments (16)

antoscarface avatar antoscarface commented on July 24, 2024

I tryed also to launch the getTickets.php sample, changing the credentials inside the file, but I have the same problem.

I set the subdomain, username and token, properly generated on zendesk API admin page.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

Can you share with me the code you used and where it is located in comparison to your webroot?

Sadly the error is not very descriptive. The time I've seen this is when my server couldn't access the internet, but it is a very general error and we cannot be sure. Providing more information would help both of us debug this error.

Thanks

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi @miogalang,

the code is the "getTickets.php" example you give with the source and when I run also with phpunit.

In the frontend I have this message:

Please check your credentials. Make sure to change the $subdomain, $username, and $token variables in this file.

If I run with PHPUnit, I receive the error I quoted previously:

Zendesk\API\Exceptions\ApiResponseException : Error completing request [url] https://yithemes1432719252.zendesk.com/api/v2/tickets.json [http method] GET [body]

I can't understand the reason and I don't know what else I can say.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

can you add this to the bottom.

} catch (\Zendesk\API\Exceptions\ApiResponseException $e) {
    echo 'Please check your credentials. Make sure to change the $subdomain, $username, and $token variables in this file.';
    echo $e->__toString();
}

So we can see a better error.

The line to add is echo $e->__toString()

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi @miogalang,

here what I receive:

Please check your credentials. Make sure to change the $subdomain, $username, and $token variables in this file.

exception 'Zendesk\API\Exceptions\ApiResponseException' with message 'Error completing request [url] https://yithemes1432719252.zendesk.com/api/v2/tickets.json [http method] GET [body] ' in C:\xampp\htdocs\my\yi\yithemes\zendesk-test\src\Zendesk\API\Http.php:89 Stack trace: #0 C:\xampp\htdocs\my\yi\yithemes\zendesk-test\src\Zendesk\API\HttpClient.php(400): Zendesk\API\Http::send(Object(Zendesk\API\HttpClient), 'tickets.json', Array) #1 C:\xampp\htdocs\my\yi\yithemes\zendesk-test\src\Zendesk\API\Traits\Resource\FindAll.php(34): Zendesk\API\HttpClient->get('tickets.json', Array) #2 C:\xampp\htdocs\my\yi\yithemes\zendesk-test\samples\getTickets.php(18): Zendesk\API\Resources\Core\Tickets->findAll() #3 {main}

The credentials are correct and I use them with the version 1 of this SDK, that I'm using meanwhile without any problem.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

With the credentials, what token are you using. Is it an OAuth token or API token?

Sadly the error is coming when making the actual request. And the API is not returning an error we can see.

Thanks,

Mio

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi,

It is an API token and not OAuth token. Is it correct? I don't understand very well the second part of your message.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

Yes the API Token is correct.

So what this error we are seeing means is that guzzle is unable to make the call.
Error completing request is an error from guzzle (a utility we use) throws.
What this means is it is unable to reach to zendesk url for some reason, because if the API was throwing an error that is what would be displayed.
Personally, I've only seen this error when my server was unable to reach the internet, but it could be something else.

Can you try to ping the url using this to see if the server has access to the internet?
This way we can slowly cross out the possible problems one by one.

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi,

thank you for the help.

So, I tryed this: http://pastie.org/private/sijionpnikwn2z6sgqkyiq

The var_dump result is:

float(169)

I hope it can help.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

Ok so it means it can access the internet. Thats one thing we can cross out now.

I am going to be honest, I am unsure what is happening because the error message being returned is not very descriptive. I should look into making that better.

Let's try something different. Let's try to replicate the call using a curl

curl https://{subdomain}.zendesk.com/api/v2/tickets.json
-v -u {email_address}/token:{api_token}

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi,

I tryed it and this is the result: http://d.pr/i/1aTV4/4i4yz0O0 and then the JSON with list of tickets.

It seems to be working properly.

from zendesk_api_client_php.

miogalang avatar miogalang commented on July 24, 2024

Hi @antoscarface,

Ok so it is working.

This one is really tricky. Can we try something else?

} catch (\Zendesk\API\Exceptions\ApiResponseException $e) {
    echo 'Please check your credentials. Make sure to change the $subdomain, $username, and $token variables in this file.';
    echo $e->getErrorDetails();
}

hopefully this gives us a more descriptive error. If this fails we should try to get the error thrown in Guzzle.

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi,

I tryed it, but $e->getErrorDetails() return an array. Anyway, I echo a var dump (so this is the code http://pastie.org/private/6c8hhpptjyae7n4v6ncgvq), but I receive empty array.

But, I echo var_dump of $e object and I discovered these lines, maybe the cause of the problem:

["error"]=> string(63) "SSL certificate problem: unable to get local issuer certificate"
["url"]=> string(58) "https://yithemes1432719252.zendesk.com/api/v2/tickets.json"

and also

["message":protected]=> string(134) "cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

They are messages from GuzzleHttp\Exception\RequestException.

I'm on local environment and I'm on Windows, with XAMPP. If it's the problem, how can I resolve? Could be something to solve in the code? or maybe in the apache configuration?

from zendesk_api_client_php.

joseconsador avatar joseconsador commented on July 24, 2024

Hi @antoscarface,
Could you try the instructions on this page http://stackoverflow.com/questions/6400300/https-and-ssl3-get-server-certificatecertificate-verify-failed-ca-is-ok/16495053#16495053 . Seems that it's a common issue in XAMPP. Let us know if that helps. Thanks!

from zendesk_api_client_php.

antoscarface avatar antoscarface commented on July 24, 2024

Hi @joseconsador ,

now works great!!! :)

Thank you very much, I hope it's useful to other windows user as me! 👍

from zendesk_api_client_php.

amaendeepm avatar amaendeepm commented on July 24, 2024

Also one finding if you are using Wamp, the change has to be made in php.ini for BOTH Apace and PHP folders ;-)

from zendesk_api_client_php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.