CloudLocate Service-to-Service access using REST API

Service to Service Mode Step-by-Step Guide

Introduction

Service-to-Service access allows to access to the service requesting the location estimation directly from your application platform instead of from your devices. This approach is preferred, for example,  whenever you need the position information directly on server side  and not in the device, or when your fleet does not have access to the public internet and cannot reach directly the service end-points.

Prerequisites

To use the service you need

Procedure overview

The mains steps of this procedure are

Here below an extensive explanation for each step

Create a CloudLocate S2S Thing

The first step is to create a CloudLocate S2S things that provides you all the required parameters for the API:

The Thing let also you to:

Sign-in into the Thingstream portal and select the Location Things item from the Location Services section. Click the button to create a new Location Thing and browse to the CloudLocate section from where you can select the wizard to create CloudLocate S2S Thing.  

During the creation steps you are suggested to assign a price plan. If you skip this step the Thing will not be automatically activated and cannot be used. When you are ready to assign a plan, open the Thing panel and assign the preferred one.

Note: the service endpoint and the credentials for the REST API are specified in the details panel of the just created CloudLocate S2S thing.

Send a measurement and get a position

The service supports a JSON formatted request containing information of GNSS raw data, and/or cellular tower scan and/or Wi-Fi measurements. The format of the request is mentioned in API specification document available at https://clapi.services.u-blox.com/.

The Getting Started Guide has provided the instructions about how to generate the service payload.  Once you have received the JSON payload on your cloud application server, to obtain a position you shall send the API

https://{endpoint}/v1/unipos/s2s/location/get 

specifying:

and appending the JSON payload as body of the request.

Both can be retrieved in the credential section of your just created CloudLocate S2S thing as shown in the following picture. As initial test it is suggested to use the sample payload provided in the Getting Started guide and verify that you can receive a resposnse with the estimated position. For  very initial test purpose it is also suggested:

Remind to set:

Sample API response

A succesfull location response provides the position estimation as long as the date and time of the request, a copy of the RequestId if provided in input, and a LocationSource that indicates which source (Cellular, Wi-Fi or GNSS) have been used for the provided estimation.

{

    "Location": {

        "Lat": 51.496268,

        "Lon": -0.0949408,

        "Unc68": 27.0

    },

    "DateTime": "2023-09-14T13:02:01",

    "RequestId": "82cb34c9-88c9",

    "LocationSource": "WiFi"

}


Self Reporting API

Thingstream provides a rich Customer API to allow you to carry out the majority of functions that can be done in the portal in addition to providing the ability to Report Usage on your S2S devices.