API KEY doesn't works


Hello I set this to use Freshdesk's API.


baseURL = "https://MYACCOUNT.freshdesk.com/api/v2/contacts";

postData = "{\"name\":\"Alex\",\t\"email\":\"mb_testing@yahoo.it\"}";

mapp = Map();

//postData = encodeurl(postData);

myHeaders = Map();

myHeaders.put("apykey","MYAPI");

myHeaders.put("Content-Type","application/json");

response = postUrl(baseURL,mapp,myHeaders,true);

info response;


But I obtain {"code":"invalid_credentials","message":"You have to be logged in to perform this action."}


Anyone could help me to set apikey?


Thanks!



3 replies

Userlevel 3

Hello @maurizio.bolognani,

 

Apologies for the delay in getting back here. Please make sure you use the right Freshdesk account URL and API key in the API call request. In case you are still facing discrepancies, feel free toadd a note here or drop an email to support@freshdesk.com and we would be happy to help!

 

Cheers,

Freshdesk Community Team

Hello I set this to use Freshdesk's API.

 

baseURL = "https://MYACCOUNT.freshdesk.com/api/v2/contacts";

postData = "{\"name\":\"Alex\",\t\"email\":\"mb_testing@yahoo.it\"}";

mapp = Map();

//postData = encodeurl(postData);

myHeaders = Map();

myHeaders.put("apykey","MYAPI");

myHeaders.put("Content-Type","application/json");

response = postUrl(baseURL,mapp,myHeaders,true);

info response;

 

But I obtain {"code":"invalid_credentials","message":"You have to be logged in to perform this action."}

 

Anyone could help me to set apikey?

 

Thanks!

Freshdesk's APIs belong to the Representational State Transfer (REST) category. They allow you to perform 'RESTful' operations such as reading, modifying, adding or deleting data from your helpdesk. The APIs also support Cross-Origin Resource Sharing (CORS).

https://developers.freshdesk.com/api/

Yes, @kuchkr .
Adding to this, please ensure that you are using the API key of a Full-time agent with the ability to access the contacts to ensure the API key works without any issue.
Cheers!

Reply