Avatar

How to get Dignostic details form a diagnostic id?

0

Hi All,

I am using geotab api to get the fault data for the devices, I have stored the device ids list in my database and I am fetching the faults using "Get" geotab api where "typeName" = "FaultData":

JSON-RPC={
"method":"Get",
"params":{
"typeName":"FaultData",
"search":{
"fromDate":"'+ fromDate +'",
"toDate":"'+ toDate +'",
"deviceSearch":{
"id":"'+ deviceId +'"
}
},
"credentials":{
"database":"'+databaseName+'",
"sessionId":"'+ sessionId +'",
"userName":"'+userId+'"
}
}
}

now I got the fault data with some diagnostic Id, the daignostic id fromat is like "anEQgsBneLkOTeoRpRXEsEQ" for most of the devices.

consider below as the response I got from the above "get" api call:

{
"result":[
{
"amberWarningLamp":false,
"controller":{
"id":"ControllerGoDeviceId"
},
"count":1,
"dateTime":"2017-09-25T20:24:49.000Z",
"device":{
"id":"b8"
},
"diagnostic":{
"id":"anEQgsBneLkOTeoRpRXEsEQ"
},
"failureMode":"NoFailureModeId",
"faultState":"Pending",
"id":"bD717",
"malfunctionLamp":false,
"protectWarningLamp":false,
"redStopLamp":false
}
],
"jsonrpc":"2.0"
}

As this id is not giving much information about the daignostic so I want to pull its more detail info to show.
Also I have multiple daignostic Id for which I want to get the detail information in bulk request.

So is there any way to get these details by diagnostic id?

Thanks.

Anmol Nimbalkar

Please sign in to leave a comment.

2 comments

1
Avatar

Anmol,

Just like you built a local Device cache you will need to build a local Diagnostic cache by doing a Get<Diagnostic> call.

Once you have that cache you will be able to translate the id's to the actual diagnostic name and code.

Now, in terms of getting the Faults. If this is a once off then using a Get<FaultData> is the correct approach, however, if this is something you will be doing constantly then you should look at the GetFeed<FaultData> call as this is meant for that kind of data pull.

Mauricio Muniz 1 vote