freshworks / fresh-samples

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

Creating a ticket redirects? PHP #16

Closed EvanHerman closed 8 years ago

EvanHerman commented 8 years ago

I'm using the sample PHP code to try and create a ticket via cURL. It seems that the response I'm getting back is "You are being redirected."

The ticket isn't being created either. Is there some reason this would be happening that I'm overlooking?

I've copied the PHP sample code verbatim, but swapped out the fd_domain, token and cc_emails (inside the data arraay).

Thanks, Evan

EvanHerman commented 8 years ago

Sorry, it seems that the endpoint (in my case) should begin https:// instead of http://.

Thanks

adarshvsukumaran commented 7 years ago

Hi, I have changed to https but still the ticket is not created. Do we need to change anything in the admin panel? Thanks

seetharam-rajagopal commented 7 years ago

Which file are you trying to execute ?

adarshvsukumaran commented 7 years ago

Hii..Thanks for the replay.

I got a sample php code from github. https://github.com/freshdesk/fresh-samples/blob/v1/php_samples/create_ticket_with_custom_field.php I added my api key, and login details. Then tried to execute from my localhost. No response from curl.

seetharam-rajagopal commented 7 years ago

Hi,

If you are trying it first time, I suggest you to use the V2 API instead of V1. We'll be deprecating the V1 API soon. Please tryout the samples in V2 from this link

thanks.

adarshvsukumaran commented 7 years ago

Hi, I have tried V2, but i am geing a response code {"code":"ssl_required","message":"SSL certificate verification failed."}

The api key to be base64 encoded? Sorry, i am completely new to Freshdesk. Thanks

seetharam-rajagopal commented 7 years ago

Update the values for the following variables in the sample file,

$api_key = "API_KEY"; $password = "x"; $yourdomain = "YOUR_DOMAIN";

$api_key = API_KEY; is unique key which can be obtained from the user profile page of the Freshdesk APP $password = "x"; leave it as it is

$yourdomain = "YOUR_DOMAIN"; "sample" is the domain name in sample.freshdesk.com

Don't modify other lines in the file. You can start with this file. Documentation can be accessed from this link