OS1 Services
...
Location Tracking
SIM-Based Tracking
14 min
introduction sim based tracking enables app developers to locate mobile devices using a driver's cellular network using the location coordinates recorded by the driver’s cellular network, you can locate and monitor your fleet’s activities without the use of traditional gps trackers sim based tracking works for both feature phones and smartphones it provides real time location monitoring of the devices this developer guide explains how to integrate with the motion tracking service (mts) platform to add sim based tracking capabilities to your applications the integration is built around the following key features consent management to track your ground resources you need to first get consent from the driver being tracked using our consent apis apps can initiate a consent to track and check its status consent is shared to the driver using an sms message to which they can reply and provide consent to track location tracking once you have retrieved consent from the driver you can create the track and receive traces for that device in real time integration flow integrating sim based tracking with your applications involves the following steps initiate consent use requestconsent api to obtain consent for sim based tracking device location tracking manage tracking requests and retrieve location data create a track use createtrack to create a new tracking request start/stop tracking use updatetrack to initiate tracking a device to obtain real time or periodic location data, or to stop tracking a device when it is no longer needed or at the end of the consent period retrieve data gettracedata to retrieve the device location tracking data step 1 initiate consent for request consent for a phonenumber by calling requestconsent view the request parameters below path parameters parameter data type description msisdn string we'll accept phone number in msisdn format this regex will be used to validate it ^\\\d{1,12}$ body parameters true false 177false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type refer to the example below for requesting consent { "callback" { "url" "https //myserver com/callbacks", "meta" {}, "secret" "mwyyzdflmmu2n2rm" } } the response includes the status of the consent request { "data" { "status" "initiated" }, "error" {} } step 2 retrieve consent after initiating consent, call retrieveconsent to fetch the consent status this returns the consentstatus, and the time the consent was requested and received { "data" { "consentstatus" "allowed", "expiryat" 1699873625645, "consentrequestedat" 0, "consentreceivedat" 0 } } step 3 create a location track call createsimtrack to initiate tracking for a device the request requires the msisdn note that any created tracks not started within 24 hours will be deleted see the request body parameters below true false 189false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type example request { "msisdn" "919876543210", "defaultstart" false, "expiry" "14d", "callback" { "url" "https //example com/sim tracking callbacks", "meta" {}, "secret" "c2vjcmv0" } } example response { "error" {}, "data" { "trackid" "mts\ track 497cff90 a8b4 e4cc 0083 b2b16071ba1a", "trackname" "my new sim track" } } the response includes the data object containing the trackid and trackname step 4 start or stop tracking call updatesimtrack to start or stop tracking by passing start or stop in request body see the request parameters below you can start or stop a track using the trackid or trackname path parameters true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type body parameters true false 143false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type the example request below starts tracking { "operation" "start", "callback" { "url" "https //myserver com/callbacks", "meta" {}, "secret" "string" } } on success, the api returns a 202 response with an id { "data" { "id" "mts\ track\ eaed3c14 b990 4f20 e911 bb31c4fde895" } } step 5 get location data consent consent status status once you have initiated the tracking process, if you notice that the trace data has unexpectedly stopped without you stopping it, this could be because the user revoked their consent while the tracking was in progress in such situations, developers need to call getconsentstatus to verify the existence of a valid consent after the tracking has started, an application will need to call gettracedata using the trackname or trackid to get the trace points of the device in geojson format step 6 get tracking status developers can use the following apis to retrieve the tracking status these apis returns the status of tracking (started/stopped) associated with the given deviceid with details such as trackingid and the duration of tracking getsimtrackstatusbymsisdn getsimtrackstatusbyname getsimtrackstatusbyid gettrackingstatus { "data" { "status" "initiated", "trackid" "track12345", "externalrefid" "ref 93586cb3 3388 4abe ac2b 60db3280a4d6", "deviceid" "device98765", "consentstatus" "granted", "startedat" 1633036800, "stoppedat" 1633040400, "rsoutput" { "confidence" "high", "distance" 500, "errorreason" \[ "lowsignalstrength" ] } } }