Avatar

HTTP Get for DutyStatusViolationSearch

0

I am currently trying to build out a HTTP link so I can download DutyStatusVIolations that are coming through.  However, I can't seem to get the link to work correctly. Can someone let me know what may be wrong with this link?

 

https://myXX.geotab.com/apiv1/Get?typeName=DutyStatusViolation&credentials={"database":"DATABASE","userName":"USERNAME","password":"PASSWORD"}&search={"fromDate":"2017-11-23T00:00:00.000Z","toDate":"2018-11-24T00:00:00.000Z", "userSearch":"bbb"}

 

I get the below error message when I run this:

{"error":{"message":"Exception of type \\u0027Geotab.Serialization.JsonSerializerException\\u0027 was thrown.","code":-32700,"data":{"id":"6c4cb94c-75bd-4702-a9d8-d28b159d1d12","type":"JsonSerializerException","requestIndex":0},"name":"JSONRPCError","errors":[{"message":"Exception of type \\u0027Geotab.Serialization.JsonSerializerException\\u0027 was thrown.","name":"JsonSerializerException"}]},"jsonrpc":"2.0","requestIndex":0}

Jon Graber

Please sign in to leave a comment.

7 comments

1
Avatar

Hello Jon,

The available options for userSearch when searching for Duty Status Violations are Id and GroupSearch. You can find more information on this here.

You will have to modify the userSearch part of your call as shown below:

https://myXX.geotab.com/apiv1/Get?typeName=DutyStatusViolation&credentials={"database":"DATABASE","userName":"USERNAME","password":"PASSWORD"}&search={"fromDate":"2017-11-23T00:00:00.000Z","toDate":"2018-11-24T00:00:00.000Z","userSearch":{"Id":"b3C"}}

 

Shivansh Singla 1 vote
0
Avatar

Hello Shivansh and Thank you!  That worked!

I do have a side question on top of this.  Can you tell me what the proper code would be to search for multiple ID's at once?  IE:  b3A, b3B, b3C?

 

Thanks again!

Jon

Jon Graber 0 votes
0
Avatar

No problem, Jon.

You can make use of the GroupSearch parameter to search for all the users that belong to a group.

If you don't want to use GroupSearch then, unfortunately, you will have to make multiple calls/requests to fetch data for multiple users as it cannot be done in a single call. This can be done more efficiently using Multicalls.

 

Shivansh Singla 0 votes
0
Avatar

Thanks, but am I mistaken but can you do a GroupSearch with the DutyStatusVIolation?  I just tried and it gave me an error about having to do a userSearch.

 

 

{"error":{"message":"Search in DutyStatusViolationBridge must be DutyStatusViolationSearch with a
UserSearch defined.","code":-32000,"data":{"id":"76c7b249-4c74-416c-b06a-748ae5428912","type":
"ArgumentException","requestIndex":0},"name":"JSONRPCError","errors":[{"message":"Search in
DutyStatusViolationBridge must be DutyStatusViolationSearch with a UserSearch defined.","name":
"ArgumentException"}]},"jsonrpc":"2.0","requestIndex":0}
Jon Graber 0 votes
0
Avatar

Just in case you have a better way to do this.  My goal is to grab all of the DutyStatusViolations for everyone during a specified time frame.  So the UserID search is in my way!

 

Jon Graber 0 votes
0
Avatar
Shivansh Singla 0 votes
0
Avatar

Thanks Shivansh, so your tips have worked tremendously but I found a potential issue.  I appear to be missing records.  

 

I'm using the below link:

https://myDDD.geotab.com/apiv1/Get?typeName=DutyStatusViolation&credentials={"database":"DATABASE","userName":"USERNAME","password":"PASSWORD"}&search={"fromDate":"2017-11-23T00:00:00.000Z","userSearch":{"companyGroups":[{"Id":"GroupCompanyId"}]}} 

 

And I'm getting a lot of records but there are a few missing.  For instance I have about 40 records from the same location/user with a start date of March 2018 that are missing.  I say they are missing because these records came through on the Violations Report you can manually download from GeoTab.

Do you know of any reasons or causes of this that I can look into?  

Jon Graber 0 votes