How to download the saved search data using API

How to download the saved search data using API

Use the below API to download saved search data in CSV or JSON format:
https://www.site24x7.com/api/applog/saved_searches/download/<search_id>/<from_date>/<to_date>?data_format=json&range=1-100&order=desc

The following are the field values passed to the API:

Field Value
Description
search_id

  1. This is the long search ID value taken from the saved search list API.
  2. To get the list of saved searches, use the API: https://www.site24x7.com/app/api/applog/saved_searches
  3. Use the below cURL command to get the search ID:
    $ curl "https://www.site24x7.com/app/api/applog/saved_searches" \
    -X GET \
    -H "Accept: application/json; version=2.0" \
    -H "Authorization: Zoho-oauthtoken 1322.41d9f2cfbd1b7a8f9ef14be125f"
  4. For the above cURL command, the result will be as below:
    {
       "code": 0,
        "message": "success",
      "data": [
        {
         "system_generated": false,
          "query": "logtype=\"Test Log\" and message contains \"exception\"",
           "logtype_id": "10000109515",
           "display_name": "Exception Message",
           "search_properties": {
              "default_widget_type": "number"
          },
     "search_id": "10000109255"
      }
     ]
    }
  5. You can find your search query with the display_name from the result data. Use the search_id value of your respective search query.
from_date
dd-MM-yyyy%20HH:mm  ("from" time value in your account's time zone)
to_date
dd-MM-yyyy%20HH:mm  ("to" time value in your account's time zone)
data_format
csv (for CSV format)
json (for JSON format)
range
1-100 (1 to 100 or 101 to 200) 
You can download up to 1,000 lines at once.
order
asc or desc ("asc" is ascending; "desc" is descending)

Here search_id, from_date, to_date, and data_format are mandatory fields. range is not mandatory for groupby query.

Once you know the search_id, use the API mentioned earlier to download saved search data in CSV or JSON format. 

Below is the sample cURL command to download saved search data in JSON format:
      $ curl "https://www.site24x7.com/api/applog/saved_searches/download/312021000000906003/18-05-2020%2004:16/19-05-2020%2004:16?data_format=json&range=1-500&order=desc" \
    -X GET \
    -H "Accept: application/json; version=2.0" \
    -H "Authorization: Zoho-oauthtoken 1322.41d9f2cfbd1b7a8f9ef14be125f"

Below is the sample cURL command to download saved search data in CSV format:
      $ curl "https://www.site24x7.com/api/applog/saved_searches/download/312021000000906003/18-05-2020%2004:16/19-05-2020%2004:16?data_format=csv&range=101-200&order=desc" \
    -X GET \
    -H "Accept: text/csv; charset=utf-8" \
    -H "Authorization: Zoho-oauthtoken 1322.41d9f2cfbd1b7a8f9ef14be125f"