Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wkm97 opened this issue Jan 22, 2020 · 15 comments
Closed

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

wkm97 opened this issue Jan 22, 2020 · 15 comments

Comments

@wkm97
Copy link

wkm97 commented Jan 22, 2020

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
Copy link
Contributor

@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
Copy link
Author

wkm97 commented Jan 22, 2020

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
Copy link
Contributor

papnoisanjeev commented Jan 22, 2020

@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
Copy link
Author

wkm97 commented Jan 22, 2020

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
Copy link
Contributor

@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
Copy link
Contributor

@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
Copy link
Author

wkm97 commented Jan 30, 2020

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

@wkm97 wkm97 closed this as completed Jan 30, 2020
@papnoisanjeev
Copy link
Contributor

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

@papnoisanjeev
Copy link
Contributor

@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.

@yodakoi
Copy link

yodakoi commented Mar 17, 2020

@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"

@yodakoi
Copy link

yodakoi commented Mar 17, 2020

.htaccess is correct, it's like mentionned here

@yodakoi
Copy link

yodakoi commented Mar 17, 2020

@wkm97 are you succeed to resolve the issue ?

@yodakoi
Copy link

yodakoi commented Mar 17, 2020

it resolved, i just replaced Bearer by Basic

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

@papnoisanjeev
Copy link
Contributor

@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
Copy link

steven4547466 commented Jul 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants