Update GPS Location after scan
Overview
This API endpoint enables users to update their GPS location after they opt-in to share it. By providing scan-position data, brands can gain insight into where scans originate and target specific areas with promotions or other initiatives. It's important to note that for this data to be accurate, the user must allow the web-page to access their location. If this is not allowed, the system will default to IP geolocation, which may be less accurate depending on the consumer's internet connection.
This endpoint can be called as soon as the scan_id is available and will mark the scan on the Dashboard. The landing page must then collect the latitude/longitude location and pass it in as input.
Workflow
- Setup a redirect to your custom landing page including
api_key
andid
parameters- e.g.
https://your-landing-page.io/?api_key={api_key}&scan_id={id}
- e.g.
- Use client side javascript and the landing page to ask user for lat,lng permission
- Fetch
api_key
&scan_id
parameter from the url - Construct a http
POST
request as described below
Endpoint Description
POST: /api/v2/consumer/scan/{scan_id}/geotag/
Authentication
API Key must be passed as a header.
X-ScanTrust-Consumer-Api-Key: <api_key>
Body Parameters POST (application/json)
{
lat: <Float>, /*Latitude*/
lng: <Float>, /*Longitude*/
}
Expected response: Response (200): Status OK
Curl Example
curl -X POST "https://api.scantrust.com/api/v2/consumer/scan/{scan_id}/geotag/" \
-H "Content-Type: application/json" \
-H "X-ScanTrust-Consumer-Api-Key: your_api_key_here" \
-d '{
"lat": 51.5074,
"lng": -0.1278
}'