Skip to main content

How I can extract EventException one by one and not all form the MyGeotab API ?

JACEV-2134
Original Poster

currently I am using the entity ExceptionEvent, but I would Events one by one.

Join the conversation

You need to be logged in to reply to this post and participate in the Geotab Community discussions.

Top Answers

EishiFUN
Geotabber

Hey @JACEV-2134​ ,

                                   

Thank you for asking your question in our community. You can absolutely filter ExceptionEvent results instead of getting all of them. The Get method accepts an ExceptionEventSearch object with several filters:                                   

                                         

 By specific exception ID:                           

 api.call("Get", {                               

  typeName: "ExceptionEvent",                         

  search: {                                  

   id: "yourExceptionEventId"

  }

 });

 

 By device, rule, and/or date range:

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   deviceSearch: { id: "yourDeviceId" },

   ruleSearch: { id: "yourRuleId" },

   fromDate: "2026-03-01T00:00:00Z",

   toDate: "2026-03-13T00:00:00Z"

  }

 });

 

 By rule type (e.g., only stock rules or custom rules):

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   ruleSearch: { baseType: "Custom" }

  }

 });

 

 You can also use resultsLimit to control how many results come back per call:

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   deviceSearch: { id: "yourDeviceId" },

   fromDate: "2026-03-01T00:00:00Z"

  },

  resultsLimit: 1

 });

 

 If your goal is to process exceptions incrementally as they occur (one by one in real-time), consider using GetFeed instead of Get. It returns only new/changed records since your last call using a token-based approach:

 

 // First call - get initial token

 let result = await api.call("GetFeed", {

  typeName: "ExceptionEvent",

  resultsLimit: 1

 });

 

 // Subsequent calls - only returns new events since last token

 result = await api.call("GetFeed", {

  typeName: "ExceptionEvent",

  fromVersion: result.toVersion,

  resultsLimit: 1

 });

 

 Key references:

 - https://developers.geotab.com/myGeotab/apiReference/objects/ExceptionEvent

 - https://developers.geotab.com/myGeotab/apiReference/objects/ExceptionEventSe

 arch

 

Let us know if you have any other questions. We are always happy to help.

 

Have a good one!

Eishi FUN

3 Replies

EishiFUN
Geotabber

Hey @JACEV-2134​ ,

                                   

Thank you for asking your question in our community. You can absolutely filter ExceptionEvent results instead of getting all of them. The Get method accepts an ExceptionEventSearch object with several filters:                                   

                                         

 By specific exception ID:                           

 api.call("Get", {                               

  typeName: "ExceptionEvent",                         

  search: {                                  

   id: "yourExceptionEventId"

  }

 });

 

 By device, rule, and/or date range:

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   deviceSearch: { id: "yourDeviceId" },

   ruleSearch: { id: "yourRuleId" },

   fromDate: "2026-03-01T00:00:00Z",

   toDate: "2026-03-13T00:00:00Z"

  }

 });

 

 By rule type (e.g., only stock rules or custom rules):

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   ruleSearch: { baseType: "Custom" }

  }

 });

 

 You can also use resultsLimit to control how many results come back per call:

 api.call("Get", {

  typeName: "ExceptionEvent",

  search: {

   deviceSearch: { id: "yourDeviceId" },

   fromDate: "2026-03-01T00:00:00Z"

  },

  resultsLimit: 1

 });

 

 If your goal is to process exceptions incrementally as they occur (one by one in real-time), consider using GetFeed instead of Get. It returns only new/changed records since your last call using a token-based approach:

 

 // First call - get initial token

 let result = await api.call("GetFeed", {

  typeName: "ExceptionEvent",

  resultsLimit: 1

 });

 

 // Subsequent calls - only returns new events since last token

 result = await api.call("GetFeed", {

  typeName: "ExceptionEvent",

  fromVersion: result.toVersion,

  resultsLimit: 1

 });

 

 Key references:

 - https://developers.geotab.com/myGeotab/apiReference/objects/ExceptionEvent

 - https://developers.geotab.com/myGeotab/apiReference/objects/ExceptionEventSe

 arch

 

Let us know if you have any other questions. We are always happy to help.

 

Have a good one!

Eishi FUN

JACEV-2134
Original Poster

Hi Eishi, thanks for answer. Currently I am using this from Date, however, it's missing the current month, could you help me please to modify the code ?

let 

  Origen = () => 

  let 

    // Simplemente toma el momento actual y resta 60 días

    fromDate = DateTimeZone.RemoveZone(DateTimeZone.FixedUtcNow()) - #duration(60, 0, 0, 0)

  in 

    fromDate

in 

  Origen

EishiFUN
Geotabber

Hey @JACEV-2134​  I had one of our developers take a look at this and this is what they told me: "Looking at the customer's code snippet, they only show us fromDate and there is no toDate.

So, if the fromDate is 60 days minus the current date, then they should be getting data.

If they're not getting the data, I'd suggest them to check if they have data for the current month.

 

Here's an example they can try in the JS runner.

 

If the runner is properly showing results for the current month, then there is some issue with their power query script"

 

Let us know if you run into any issues or have any questions. Always happy to help.

Still have questions?