uvdesk / api-bundle

API Integration for UVdesk Community Helpdesk System.
MIT License
17 stars 14 forks source link

Unable to fetch or create tickets using Rest API. #2

Closed wkm97 closed 4 years ago

wkm97 commented 4 years ago

I created a token for the authentication in uvdesk. image

and I'm unable to fetch tickets using it. There is an internal server error found when trying to fetch tickets. image

May I know what did I miss or is there any log file to trace the problem?

papnoisanjeev commented 4 years ago

@wkm97

Write Basic instead of Bearer for Authorization. and secondly locate this file. config->packages->security.yaml and open security.yaml.

Now you just need to change the sequence in firewalls made change as per given in screenshot. check screen shot.

api

Clear your project cache by: php bin/console c:c

wkm97 commented 4 years ago

Thanks for replying. I had followed the steps that you kindly provide me and cleared the cache. It successfully returned something to me but there are still problem occurred. image The log file is shown as follows: image

papnoisanjeev commented 4 years ago

@wkm97

You are getting internal server error may be it can be due to syntax error or due to some exception while doing API request.

Locate file. vendor->uvdesk->api-bundle->Security->Guards->APIGuard.php

Open file and find getCredentials() function and dump step by step like dump($authorization_key); die; and find from where you are getting exception.

We have checked and it is working fine for us.

APITickets

wkm97 commented 4 years ago

I added the dump function over here: image

Where can I find the dumped value? Is it correct that I start this dump server and it will display it over here? It didn't show anything when I try to fetch the tickets. image

papnoisanjeev commented 4 years ago

@wkm97 You will see values of variable which you have dump in response of your API request. All the API request will go through this API guard first so you can check it here where you are failing to make a API request.

APIDump1

papnoisanjeev commented 4 years ago

@wkm97 Is your issue resolved?

If not, you can create a support ticket by mail : support@uvdesk.com here or from visiting here https://support.uvdesk.com/en/customer/create-ticket/

wkm97 commented 4 years ago

There are other issues on my side (not about uvdesk), I will continue trying. If problem encountered I will create a support ticket.

papnoisanjeev commented 4 years ago

@wkm97
Sure you can create a support ticket if you are facing any problem with uvdesk (https://github.com/uvdesk/community-skeleton).

papnoisanjeev commented 4 years ago

@wkm97 open your project go to: public->.htaccess add these lines in your .htaccess file:

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

htaccess

And clear your project cache by: php bin/console c:c

and try using this if it works for you.

hlallahom commented 4 years ago

@papnoisanjeev i have the same error, have u a solution to resolve it ? i tried to get tickets list using curl :

curl -X GET -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "https://xxxxxxxxxxx/api/v1/tickets"

hlallahom commented 4 years ago

.htaccess is correct, it's like mentionned here

hlallahom commented 4 years ago

@wkm97 are you succeed to resolve the issue ?

hlallahom commented 4 years ago

it resolved, i just replaced Bearer by Basic

curl -X GET -H "Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "https://xxxxxxxxxxx/api/v1/tickets"

papnoisanjeev commented 4 years ago

@tigersf2 Glad to know that your issue has been resolved. For more details check this blog: https://www.uvdesk.com/en/blog/api-resource/

steven4547466 commented 4 years ago

I know I'm reopening an old ticket, but I am getting this same error with, but only when attempting to POST to /tickets the weirdest thing was, I used to be able to I successfully created 4 tickets before I started getting the 500 error. I can also still GET /tickets and return all ticket data successfully, but posting just stopped working for whatever reason. Literally just was trying to post to /tickets and not /ticket, my mistake.