Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team,
We are attempting to create a REST connection in Qlik Cloud to extract data from Freshsales CRM using its API.
--> Issue Description:
The REST connection in Qlik Cloud is getting established successfully. However, when trying to fetch data, we are unable to retrieve any response in supported formats (JSON, XML, CSV). Instead, we are receiving an HTML response, which appears to be a login page.
--> Testing Done:
We tested the same API endpoint via Postman. Even in Postman, the response returned is HTML instead of JSON.
--> API Details:
Endpoint used: https://<domain>.freshsales.io/api/deals
Method: GET
Authentication used: API Key via Authorization header (Authorization: Token token=API_KEY)
--> Observed Error:
In some cases, API returns:
{
"login": "failed",
"message": null
}
In other cases, a full HTML page (Freshworks login page) is returned.
Expected Behavior:
The API should return data in JSON format containing deals information.
--> Request:
If this issue is related to Qlik REST connector configuration
Any required changes in authentication setup
Handling of redirects / HTML responses in Qlik Cloud
Any additional headers or configurations needed
Hi @nilesh007,
My very first tip when working with REST APIs is: use Postman. Always!
Setting up your REST API in Postman will guarantee you know how the API works, without any other external variables interfering in the process.
A quick note: It took me a while to create a free account on Freshsales.io. At some point I realized the one you are using is an old version of the system, not available anymore for me to test. But, I have created an account at freshworks.com and the APIs are very similar. So, what works for me, should work for your freshsales.io.
# Postman Setup
To get a Deal, you have to use this endpoint:
https://developers.freshworks.com/crm/api/#view_a_deal
Following a screen shot with my Postman configuration.
The important things here is to know your Tenant URL, the API Token and the Deal ID.
The Tenant URL and the API Token you can get from your Freshsales.io user configuration account - again, I don't know for sure where it is located because I don't have the same account as you.
The Deal ID I got from my Freshworks Dashboard. I have selected a Deal and I found the ID in the URL - there are other ways to get it using the APIs as well.
I will continue this reply later ...
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Continuing ...
With the Postman working we now know the connection parameters to use in Qlik Cloud.
# Qlik Cloud REST API Connection
The only catch on the Qlik Cloud REST API is to not include the Content-Type Header parameter. The green arrows show what you have to modify in the connection:
Now it works like any other REST API Wizard:
This should be enough to get you a Deal details. When returning lists, you will have to implement a Pagination process in the REST API Connection, or in the Load Script - when there is no way to set that up in the connection itself.
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Hi All,
Thanks for your response. By using https://<domain>.freshsales.io/api/deals/view, it worked, and I was able to fetch the data.
In reviewing their docs, a few thoughts:
- On their examples (e.g. deals, products), they show two headers:
1. Authorization: You seem to have this in an expected manner if you're getting past the login screen)
2. Content-Type: application/json
The 2nd would plausibly explain why you aren't getting JSON as a response and instead appear to get a HTML page. Odd API design but not unheard of.
- The endpoint in use. You reference GET /api/deals but that endpoint doesn't exist. That path looks to be to create a deal (https://developer.freshsales.io/api/#create_deal). In their view deal API (https://developer.freshsales.io/api/#list_all_deals), there looks to be a few steps.
Hi @nilesh007,
My very first tip when working with REST APIs is: use Postman. Always!
Setting up your REST API in Postman will guarantee you know how the API works, without any other external variables interfering in the process.
A quick note: It took me a while to create a free account on Freshsales.io. At some point I realized the one you are using is an old version of the system, not available anymore for me to test. But, I have created an account at freshworks.com and the APIs are very similar. So, what works for me, should work for your freshsales.io.
# Postman Setup
To get a Deal, you have to use this endpoint:
https://developers.freshworks.com/crm/api/#view_a_deal
Following a screen shot with my Postman configuration.
The important things here is to know your Tenant URL, the API Token and the Deal ID.
The Tenant URL and the API Token you can get from your Freshsales.io user configuration account - again, I don't know for sure where it is located because I don't have the same account as you.
The Deal ID I got from my Freshworks Dashboard. I have selected a Deal and I found the ID in the URL - there are other ways to get it using the APIs as well.
I will continue this reply later ...
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Continuing ...
With the Postman working we now know the connection parameters to use in Qlik Cloud.
# Qlik Cloud REST API Connection
The only catch on the Qlik Cloud REST API is to not include the Content-Type Header parameter. The green arrows show what you have to modify in the connection:
Now it works like any other REST API Wizard:
This should be enough to get you a Deal details. When returning lists, you will have to implement a Pagination process in the REST API Connection, or in the Load Script - when there is no way to set that up in the connection itself.
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Hi All,
Thanks for your response. By using https://<domain>.freshsales.io/api/deals/view, it worked, and I was able to fetch the data.