How to get a list of Events using REST API

 

Requisites

Resource used

Events Eventrules

This is the first resource we will use. We need to gather a list of EventRuleIds to use later on with the next resource Events.

mceclip4.png

We start using the eventrules resource (2) to get the event rules id's:

1. Login to http://host_name/comGpsGate/api/v.1/test 

Note: replace host_name with your actual server IP address or host name.

2. Click on the resource name, then > Try it out

mceclip2.png

3. Insert the parameters required. This API resource requires app ID and date, userID, From, Until and Filter. Then press Execute.

mceclip1.png

4. In the response you should receive a list of the events rules available in the application selected with their respective id's.

mceclip3.png

5. Now that we know the eventID's we can use them in our next query using the resource events (1)

mceclip6.png

6. We enter the parameters requested by this resource

Example: we want to list all Overspeeding events. Overspeeding events have the ID 206 in our previous screenshot.

mceclip7.png

7. The answer will give us all events from that date for the selected unit of the specified date. Each repetition in the structure of the response is one different event.

2019-12-11_12-55-38.png

Performance and Pagination

To improve the performance and have better scalability, there is a limit of 1000 records in the response of an HTTP GET request. This number can be decreased by sending PageSize parameters in the query string of your request, however, it cannot exceed 1000. If there are more records than the number specified in the PageSize parameter (or 1000 by default), a link to the next page is sent back along with the response in x-pagination header. Here is an example of x-pagination header for a request where the specified PageSize was 100.