OS1 Services
...
Movement Tracking System
Location Tracking
SIM-Based Tracking
14min
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 parameter data type description callback callback3p callback details at which user will receive callback response callback url string (pattern) url callback meta object developers can add a meta object that will be a part of the callback body callback secret string base64 encoded hmac secret key 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 parameter description msisdn the msisdn using the phonenumber format "9198 " defaultstart the start of the track if the flag is passed as true , tracking will start and the api will return a 202 if it's passed as false , tracking won't start and and the response will be 201 expiry the track expiration the maximum allowed time for the track to stop is 60 days if stop track api is not called examples 2 hours > 2h, 1 day > 1d, 50 seconds > 50s, 3 hours 4 minutes 7 seconds > 3h4m7s callback the callback details at which user will receive callback response callback url url to receive the callback response must match the pattern https? //(www\ )?\[ a za z0 9@ % \\+#=]{2,256}\\ \[a z]{2,4}\b(\[ a za z0 9@ % \\+ #?&//=] ) callback meta a meta object that will be part of the callback body optional and can contain user defined data callback secret base64 encoded hmac secret key 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 parameter data type description trackid or trackname string the unique id for the mts track body parameters parameter description operation example start enum \[start, stop] the operation to perform callback object containing callback details callback url url to receive the callback response must match the pattern https? //(www\ )?\[ a za z0 9@ % \\+#=]{2,256}\\ \[a z]{2,4}\b(\[ a za z0 9@ % \\+ #?&//=] ) callback meta a meta object that will be part of the callback body optional and can contain user defined data callback secret base64 encoded hmac secret key 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" ] } } }