freshworks / fresh-samples

Samples of code created by freshdesk
184 stars 181 forks source link

custom-widget-sample.html #2

Closed brunougomes closed 9 years ago

brunougomes commented 10 years ago

Hello,

I am working in a simple code that acess the Freshdesk api, to create a new ticket. But, I got a CORS error. I am looking for solutions, some people said to me to modify thing in my webserver, but I cant do anything in there.

So, I find your solution to create a ticket by Ruby. I am trying to figure out how your api works.

In the file custom-widget-sample.html you have a script ... url:"http://mystoreinventory.freshdesk.com/orders.php", ...

And I want to ask, HOW you set the "orders.php" file in you freshdesk domain?

Thank you for your help :)

thanashyam commented 9 years ago

Please place this code on top of your php script.

header("Access-Control-Allow-Origin: yourdomain.freshdesk.com");

Please remember to change yourdomain.freshdesk.com to your account domain.

thanashyam commented 9 years ago

If you are looking to use Freshdesk API endpoints and create tickets/do something from your browser, it will not be possible.

We recommend you to proxy the request through your server to achieve that. Please check this https://support.freshdesk.com/solution/categories/159648/folders/267901/articles/200094-javascript-access-to-freshdesk-api-from-another-domain