STIGA INTEGRATION API General info: API host: connectivity-production.stiga.com Authorization type: firebase bearer token
How to get the firebase bearer token: •
Retrieve firebase auth bearer token
Request Parameters: Url: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword" Query Params:
o
key: AIzaSyCPtRBU_hwWZYsguHp9ucGrfNac0kXR6ug (Firebase API Key for auth)
Body:
o o o
email: string, description: your email registered in app password: string, description: your password linked to your email returnSecureToken: boolean, description: must be true to retrieve your bearer Token
Example Request: POST: https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=AIzaSyCPtRB U_hwWZYsguHp9ucGrfNac0kXR6ug Body: {“email”: “example@email.com”, “password”: “Password.1”, “returnSecureToken”: true}
•
Example Request in Vanilla JS
o o o o
const retriveIdToken = async (email, password) => {
o o o o o o o o o o o o
try { const response = await fetch( 'https://www.googleapis.com/identitytoolkit/v3/relyingparty /verifyPassword?key=API_KEY', { metodi: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ email: email, password: password, returnSecureToken: true, }), }, );
o o o o o o o o o o o o o o o o
const data = await response.json(); if (response.ok) { // Authentication successful, retrieve the ID token const idToken = data.idToken; console.log('ID Token:', idToken); return idToken; } else { // Authentication failed, handle the error console.error('Authentication error:', data.error.message); } } catch (error) { console.error('Network error:', error.message); } };
Endpoints: •
GET garage/integration
Description: Get devices linked to your account
Headers: Authorization: Bearer {your firebase bearer token} [REQUIRED]
Request Parameters: Empty
Example Request: GET: https://connectivity-production.stiga.com/api/garage/integration
Example Response: 200: Fields Description: •
Data: [ o
type: [string] describe the attributes entity
o
attributes: { ▪
uuid: [string] uuid of the device
▪
name: [string] name of the device
▪
product_code: [string] product code of the device
▪
serial_number: [string] serial number of the device
▪
device_type: [string] describe the device type
} ] •
POST devices/{uuid}/command/startsession Description: Start mowing session for the selected device Info: device_type of the selected device must be “autonomous_robot”
Headers: Authorization: Bearer {your firebase bearer token} [REQUIRED]
Request Parameters: Params: •
uuid: string, format uuid, description: uuid of device linked to your account [REQUIRED]
Body: •
data: { zone_id: number [from 1 to 10], description: selected zone to force cut [NOT REQUIRED] } [NOT REQUIRED]
Example Request: POST:
https://connectivity-production.stiga.com/api/devices/05faaa66-e969-
4374-89dd-e3858e0dd7c7/command/startsession
Example Response: 200: No body res
•
POST devices/{uuid}/command/endsession
Description: End mowing session for the selected device (return to the docking station). Info: device_type of the selected device must be “autonomous_robot”
Headers: Authorization: Bearer {your firebase bearer token} [REQUIRED]
Request Parameters: Params: •
uuid: string, format uuid, description: uuid of device linked to your account [REQUIRED]
Body: empty
Example Request: POST: https://connectivity-production.stiga.com/api/devices/05faaa66-e9694374-89dd-e3858e0dd7c7/command/endtsession
Example Response: 200: No body res