BMSVieira / osticket-api

OSTicket Unofficial API
MIT License
30 stars 10 forks source link

Weird issue integrating in power automate #16

Open dfsolutions opened 1 year ago

dfsolutions commented 1 year ago

I'm trying to integrate osticket with Power automate (desktop), to retrieve a list of pending ticket. For a weird reason, the same exact query that is working perfectly on Postaman, same setting, send back a "{"status":"Error","message":"Query not found."}" instead of the list of open tickets (as in Postaman). The response clearly shows that the API is responding, but trying a little debug in index.php files, it seems like the $class and $method results in empty response.

BMSVieira commented 1 year ago

Hey @dfsolutions,

Hope you have a good day. Can you please provide me a printscreen or code preview of your request (in MPA)?

Thank you.

dfsolutions commented 1 year ago

Hello Bruno,

this is the screenshot of the MPA web request: (please consider that I tried any combination of these parameters)

Forgive that I have this screenhot in italian only. On accept I tried also application/json

@. @.

This is an example of a working request (with Postaman, same body)

@.***

This is the error on apache:

PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/dfsolutions.it/support.dfsolutions.it/ost_wbs/index.phphttps://hosting.dfsolutions.it:8443/smb/file-manager/code-editor?currentDir=%2Fsupport.dfsolutions.it%2Fvar%2Fwww%2Fvhosts%2Fdfsolutions.it%2Fsupport.dfsolutions.it%2Fost_wbs&subscriptionId=5&file=index.php&redirect=%2Fsmb%2Flog-file%2Fbrowser%2Fid%2F63 on line 37PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/dfsolutions.it/support.dfsolutions.it/ost_wbs/index.phphttps://hosting.dfsolutions.it:8443/smb/file-manager/code-editor?currentDir=%2Fsupport.dfsolutions.it%2Fvar%2Fwww%2Fvhosts%2Fdfsolutions.it%2Fsupport.dfsolutions.it%2Fost_wbs&subscriptionId=5&file=index.php&redirect=%2Fsmb%2Flog-file%2Fbrowser%2Fid%2F63 on line 38'

What I noticed that those variables are empty ,

$classe = ucfirst($requestBody['query']); $method = $requestBody['condition'];

Thank you in advance for your support and for this useful API.

Da: Bruno Vieira @.> Inviato: giovedì 16 marzo 2023 10:39 A: BMSVieira/osticket-api @.> Cc: DF Solutions @.>; Mention @.> Oggetto: Re: [BMSVieira/osticket-api] Weird issue integrating in power automate (Issue #16)

Hey @dfsolutionshttps://github.com/dfsolutions,

Hope you have a good day. Can you please provide me a printscreen or code preview of your request (in MPA)?

Thank you.

— Reply to this email directly, view it on GitHubhttps://github.com/BMSVieira/osticket-api/issues/16#issuecomment-1471612074, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALH6RVQEHINQ5PEGF2XYODLW4LNTXANCNFSM6AAAAAAV42HHIA. You are receiving this because you were mentioned.Message ID: @.**@.>>

BMSVieira commented 1 year ago

Hey,

Ok, if the endpoint is working via Postman, there's nothing wrong with the API itself.

What i think it is happening is that you are not sending the "body" correctly, or at least the URL is not going accordingly and that can explain the "class" variable being empty.

Can you please show me a preview of your code where you make the request?

Thank you.

dfsolutions commented 1 year ago

The body of the request is what I sent in the previous pic. But is exactly the cut and paste of what is working on Postman. Also, I tried from the browser, with the header modified to include the apikey, and I achieve same result : query not found.

Inviato da Outlook per Androidhttps://aka.ms/AAb9ysg


From: Bruno Vieira @.> Sent: Thursday, March 16, 2023 4:03:50 PM To: BMSVieira/osticket-api @.> Cc: DF Solutions @.>; Mention @.> Subject: Re: [BMSVieira/osticket-api] Weird issue integrating in power automate (Issue #16)

Hey,

Ok, if the endpoint is working via Postman, there's nothing wrong with the API itself.

What i think it is happening is that you are not sending the "body" correctly, or at least the URL is not going accordingly and that can explain the "class" variable being empty.

Can you please show me a preview of your code where you make the request?

Thank you.

— Reply to this email directly, view it on GitHubhttps://github.com/BMSVieira/osticket-api/issues/16#issuecomment-1472154413, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALH6RVTQQJ5AHDPRVC7L5KDW4MTVNANCNFSM6AAAAAAV42HHIA. You are receiving this because you were mentioned.Message ID: @.***>