Home > How to test the Logs API

Categories: | |


(Last Updated On: July 27, 2021)

About this Article-

This article goes over how to set up, test, and use the Logs API.

 

If you are familiar with our Developer website, you may have seen we have different APIs, among them, the Logs API which allows you to download logs from your widgets on a given timeframe, or even connect them to a third-party software.

Here, you will get the information on how to test the API and make the calls to get your logs (which are also available via the interface)

On the logs API developer page, if you click on cURL, you will be able to find the cURL to use on a Terminal, Console or elsewhere.

 

 

From this page, copy the cURL from the article, which you will you as a template to build the call and then paste on the console or terminal later (or whatever tool you are using) :

curl "https://www.snapengage.com/api/v2/{orgId}/logs?widgetId={widgetId}&start=2017-04-20&end=2017-04-28" -H "Authorization: api_token"

Then, you will need to find your :

 

  • Widget ID : You will find this under Settings, on the Get the code tab. Scroll down, click on OK, and copy onto the clipboard.

 

 

 

 

Once you have all this information, build your call based on the cURL example, replacing all the fields, and choosing your specific dates.

So, from this

curl "https://www.snapengage.com/api/v2/{orgId}/logs?widgetId={widgetId}&start=2017-04-20&end=2017-04-28" -H "Authorization: api_token"

replace each element with the actual information, so it looks like something like this :

 

curl “https://www.snapengage.com/api/v2/520279999999048/logs?widgetId=b9341ff4-9999-8888-802e-031ecf5391cf&start=2019-01-20&end=2019-03-28″ -H “Authorization: 725fb0459b33333f09fbbbc2189b5a37d

Remember to use US format for the dates (YYYY-MM-DD). You can also add time, the dates would look like this

2019-01-10T15:30:21.000&end=2019-03-10T15:12:21.000

Once you have the full call, you would simply paste it on the Terminal or Console to do a get call, you will get the result in JSON.

 

POSTMAN

 

On Postman, the call would be the same, it’s a “get” call. You would remove the cURL at the start, the brackets and the authorization so it looks like this (but with your actual information, as explained above)

https://www.snapengage.com/api/v2/520279999999048/logs?widgetId=b9341ff4-9999-8888-802e-031ecf5391cf&start=2019-01-20&end=2019-03-28

And then you would add the authorization on the Headers tab, see screenshot :

 

 

The result should look like this :

 

If your query returns more than 100 logs, there will be a link at the bottom to the next set of results.

Did you find this article helpful?

Not HelpfulNeeds WorkSo-soHelpfulVery Helpful (No Ratings Yet)
Loading ... Loading ...

Published February 27, 2019