<commit_before># Bosch Indego Mower REST API

The following operations are known to be supported by the Bosch
server.

# Authentication

```
POST https://api.indego.iot.bosch-si.com/api/v1/authenticate
Authorization: Basic bWF4Lm11c3RlckBhbnl3aGVyZS5jb206c3VwZXJzZWNyZXQ=

Request:
{
   "device":"",
   "os_type":"Android",
   "os_version":"4.0",
   "dvc_manuf":"unknown",
   "dvc_type":"unknown"
}

Response:
{
   "contextId":"ddeeff11-2233-4455-1122-334455aabbcc",
   "userId":"aabbccdd-ff11-2233-4455-66778899aabb",
   "alm_sn":"123456789"
}
```

__Notes:__
* The authorization header is standard Base64-Encoded basic authentication header 
(See https://www.ietf.org/rfc/rfc2617.txt, Chapter 2). The above example encodes 
"<EMAIL>:supersecret)

# Deauthentication

```
DELETE https://api.indego.iot.bosch-si.com/api/v1/authenticate
x-im-context-id: {contextId}

```
# Check Authentication

```
GET https://api.indego.iot.bosch-si.com/api/v1/authenticate/check
Authorization: Basic bWF4Lm11c3RlckBhbnl3aGVyZS5jb206c3VwZXJzZWNyZXQ=
x-im-context-id: {contextId}

Response:
{
   "contextId":"ddeeff11-2233-4455-1122-334455aabbcc",
   "userId":"aabbccdd-ff11-2233-4455-66778899aabb"
}
```

__Notes:__
* The authorization header is standard Base64-Encoded basic authentication header 
(See https://www.ietf.org/rfc/rfc2617.txt, Chapter 2). The above example encodes 
"<EMAIL>:supersecret)

# Getting status

```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/state
x-im-context-id: {contextId}

Response:
{  
   "state":123,
   "mowed":50,
   "mowed_ts":1460641111111,
   "mapsvgcache_ts":1459938111111,
   "runtime":{  
      "total":{  
         "operate":12345,
         "charge":2345
      },
      "session":{  
         "operate":56,
         "charge":0
      }
   },
   "error":110,
   "map_update_available":true
}
```

__Notes:__
* Replace {serial} with serial number of Indego device and {contextId} with
the context id of the authentication response.
* The authentication information has to be sent as request header "x-im-context-id".

# Controlling the mower

```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/state
x-im-context-id: {contextId}

Request:
{"state":"{command}"}
```

__Notes:__
* Replace {serial} with serial number of Indego device, {contextId} with
the context id of the authentication response and {command} with the device 
command, which should be executed.
* The following commands are understood: mow, pause, returnToDock
* The authentication information has to be sent as request header "x-im-context-id".

# Getting the calendar
<commit_msg>Added smart mode api calls<commit_after># Bosch Indego Mower REST API

The following operations are known to be supported by the Bosch
server.

# Authentication

```
POST https://api.indego.iot.bosch-si.com/api/v1/authenticate
Authorization: Basic bWF4Lm11c3RlckBhbnl3aGVyZS5jb206c3VwZXJzZWNyZXQ=

Request:
{
   "device":"",
   "os_type":"Android",
   "os_version":"4.0",
   "dvc_manuf":"unknown",
   "dvc_type":"unknown"
}

Response:
{
   "contextId":"ddeeff11-2233-4455-1122-334455aabbcc",
   "userId":"aabbccdd-ff11-2233-4455-66778899aabb",
   "alm_sn":"123456789"
}
```

__Notes:__
* The authorization header is standard Base64-Encoded basic authentication header 
(See https://www.ietf.org/rfc/rfc2617.txt, Chapter 2). The above example encodes 
"<EMAIL>:supersecret)

# Deauthentication

```
DELETE https://api.indego.iot.bosch-si.com/api/v1/authenticate
x-im-context-id: {contextId}

```
# Check Authentication

```
GET https://api.indego.iot.bosch-si.com/api/v1/authenticate/check
Authorization: Basic bWF4Lm11c3RlckBhbnl3aGVyZS5jb206c3VwZXJzZWNyZXQ=
x-im-context-id: {contextId}

Response:
{
   "contextId":"ddeeff11-2233-4455-1122-334455aabbcc",
   "userId":"aabbccdd-ff11-2233-4455-66778899aabb"
}
```

__Notes:__
* The authorization header is standard Base64-Encoded basic authentication header 
(See https://www.ietf.org/rfc/rfc2617.txt, Chapter 2). The above example encodes 
"<EMAIL>:supersecret)

# Getting status

```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/state
x-im-context-id: {contextId}

Response:
{  
   "state":123,
   "mowed":50,
   "mowed_ts":1460641111111,
   "mapsvgcache_ts":1459938111111,
   "runtime":{  
      "total":{  
         "operate":12345,
         "charge":2345
      },
      "session":{  
         "operate":56,
         "charge":0
      }
   },
   "error":110,
   "map_update_available":true
}
```

__Notes:__
* Replace {serial} with serial number of Indego device and {contextId} with
the context id of the authentication response.
* The authentication information has to be sent as request header "x-im-context-id".

# Set garden location (smart mode)

```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/location
x-im-context-id: {contextId}

Request:

{
    "latitude": "52.5243700", 
    "longitude": "13.4105300", 
    "timezone": "Europe/Berlin"
}

```
# Get garden location (smart mode)

```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/location
x-im-context-id: {contextId}

Request:

{
    "latitude": "52.5243700", 
    "longitude": "13.4105300", 
    "timezone": "Europe/Berlin"
}

```

# Enable predictive mowing (smart mode)

```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive
x-im-context-id: {contextId}

Request:

{
    "enabled": true
}

```
# Disable predictive mowing (smart mode)

```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive
x-im-context-id: {contextId}

Request:

{
    "enabled": false
}

```
# Get excluded mowing times for smart mode
```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/calendar

Response:
{
  "sel_cal" : 1,
"cals": [
        {
            "cal": 1, 
            "days": [
                {
                    "day": 0, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }, 
                {
                    "day": 1, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }, 
... 
                {
                    "day": 6, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }
            ]
        }
    ], 
```
# Set excluded mowing times for smart mode
```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/calendar

Request:
{
  "sel_cal" : 1,
"cals": [
        {
            "cal": 1, 
            "days": [
                {
                    "day": 0, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }, 
                {
                    "day": 1, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }, 
... 
                {
                    "day": 6, 
                    "slots": [
                        {
                            "En": true, 
                            "EnHr": 23, 
                            "EnMin": 59, 
                            "StHr": 22, 
                            "StMin": 0
                        }, 
                        {
                            "En": true, 
                            "EnHr": 8, 
                            "EnMin": 0, 
                            "StHr": 0, 
                            "StMin": 0
                        }
                    ]
                }
            ]
        }
    ], 
```
# Get next predicted mowing time (smart mode)
```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/nextcutting?last=YYYY-MM-DDTHH:MM:SS%2BHH:MM

Parameters
last: "YYYY-MM-DDTHH:MM:SS%2B02:00" //String(Date + "T" + Time + "+" Timezone)

Response:
{
    "mow_next": "YYYY-MM-DDTHH:MM:SS+HH:SS" 
}

```
# Set user adjustment for mowing frequency (smart mode)
```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/useradjustment

Request:
{
    "user_adjustment": 0
}

Parameters:
user_adjustment: -100 <= Integer <= 100; optimal = 0

```
# Get user adjustment for mowing frequency (smart mode)
```
GET https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/predictive/useradjustment

Response:
{
    "user_adjustment": 0 // min = -100, max = 100, optimal = 0
}

Parameters:
user_adjustment: -100 <= Integer <= 100; optimal = 0

```
# Controlling the mower

```
PUT https://api.indego.iot.bosch-si.com/api/v1/alms/{serial}/state
x-im-context-id: {contextId}

Request:
{"state":"{command}"}
```

__Notes:__
* Replace {serial} with serial number of Indego device, {contextId} with
the context id of the authentication response and {command} with the device 
command, which should be executed.
* The following commands are understood: mow, pause, returnToDock
* The authentication information has to be sent as request header "x-im-context-id".

# Getting the calendar

{'fraction_non_alphanumeric': 0.13068432671081678, 'fraction_numerical': 0.043620309050772625, 'mean_word_length': 1.448335495028102, 'pattern_counts': {'":': 137, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 23, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4061244', 'n_tokens_mistral': 4092, 'n_tokens_neox': 3563, 'n_words': 691}