Spaces API methods

As mentioned before each API call must be authorized by a valid access token. To get the valid access token you must authenticate user first.

Get Spaces List

This method is allowed for accounts with read_spaces scope granted.

Httpie:

$ http GET https://app.storeman.io/api/spaces \
  Authorization:"Bearer dyGraWQiCiJQd1JubTVvcFY0OUFfSmkyUnAxNHh6NjF5SHlpdU82dWI5blN3WFF5cHc0IiwiYWxnIjoibm9uZSJ9.eyJpc3MiOiJTdG9yZW1hbiIsImlhdCI6MTYyNDU3MjQ0MCwianRpIjoiZWE4NTgwNDYtZTk3Yi00ZGFmLWEzZDQtZmM1MjV1YWI3YjI3IiwidXNlciI6jyJpZCI6eyIkb2lkIjoiNjAzZmMzOWQ4OWE2NjA0MTE1ZmZiM2NmIn0sImVtYWlsIjoiaGVscEBzdG9yZW1hbi5pbyJ9cRa"

cURL:

$ curl -XGET https://app.storeman.io/api/spaces \
  -H 'Authorization: Bearer dyGraWQiCiJQd1JubTVvcFY0OUFfSmkyUnAxNHh6NjF5SHlpdU82dWI5blN3WFF5cHc0IiwiYWxnIjoibm9uZSJ9.eyJpc3MiOiJTdG9yZW1hbiIsImlhdCI6MTYyNDU3MjQ0MCwianRpIjoiZWE4NTgwNDYtZTk3Yi00ZGFmLWEzZDQtZmM1MjV1YWI3YjI3IiwidXNlciI6jyJpZCI6eyIkb2lkIjoiNjAzZmMzOWQ4OWE2NjA0MTE1ZmZiM2NmIn0sImVtYWlsIjoiaGVscEBzdG9yZW1hbi5pbyJ9cRa'

If the access token is valid you should get something similar to the following result:

HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Thu, 24 Jun 2021 11:32:44 GMT
ETag: W/"721a315d699014795fc6f7581671fcd7"
Referrer-Policy: strict-origin-when-cross-origin
Server: nginx/1.18.0 (Ubuntu)
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 4bc9563c-2c2c-40fe-889d-33712c83b0a4
X-Runtime: 0.289424
X-XSS-Protection: 1; mode=block

[
  {
      "ancestor_parents": [],
      "capacity": null,
      "computed_capacity": 1,
      "controller": null,
      "created_at": "2021-03-03T17:15:17.595Z",
      "id": "603fc42589a6604115ffb3dd",
      "name": "Poznań",
      "parent": "",
      "updated_at": "2021-03-03T17:15:49.024Z"
  },
  {
      "ancestor_parents": [
          "Poznań",
          "Poznań"
      ],
      "capacity": null,
      "computed_capacity": 3,
      "controller": null,
      "created_at": "2021-03-03T17:15:48.214Z",
      "id": "603fc44489a6604115ffb3df",
      "name": "YES Centrala",
      "parent": "Poznań",
      "updated_at": "2021-03-19T14:13:14.225Z"
  },
  {
      "ancestor_parents": [
          "Poznań",
          "Poznań",
          "YES Centrala"
      ],
      "capacity": null,
      "computed_capacity": 3,
      "controller": null,
      "created_at": "2021-03-03T17:16:39.046Z",
      "id": "603fc47689a6604115ffb3e1",
      "name": "Dział logistyczno-magazynowy",
      "parent": "YES Centrala",
      "updated_at": "2021-03-03T17:21:29.813Z"
  },
  {
      "ancestor_parents": [
          "Półka 1.1",
          "Szafa nr.1",
          "Poznań",
          "Dział logistyczno-magazynowy",
          "Poznań",
          "Ecomm",
          "YES Centrala"
      ],
      "capacity": null,
      "computed_capacity": 1,
      "controller": {
          "control_device": {
              "brigthness": 200,
              "highlight_time": 30,
              "host": "rpi6.cloudsailor.com",
              "id": "603fc3d489a6604115ffb3d7",
              "indicator_count": 356,
              "type": "RPi"
          },
          "indicator_range_from": 22,
          "indicator_range_to": 25
      },
      "created_at": "2021-03-17T08:57:32.772Z",
      "id": "6051c47c89a66065c5308d49",
      "name": "Pojemnik 1.1.8",
      "parent": "Półka 1.1",
      "updated_at": "2021-03-18T12:34:30.255Z"
  }
]

Highlight a Space

This method is allowed for accounts with read_spaces scope granted.

Httpie:

$ http GET https://app.storeman.io/api/spaces/{space_id}/highlight \
  Authorization:"Bearer dyGraWQiCiJQd1JubTVvcFY0OUFfSmkyUnAxNHh6NjF5SHlpdU82dWI5blN3WFF5cHc0IiwiYWxnIjoibm9uZSJ9.eyJpc3MiOiJTdG9yZW1hbiIsImlhdCI6MTYyNDU3MjQ0MCwianRpIjoiZWE4NTgwNDYtZTk3Yi00ZGFmLWEzZDQtZmM1MjV1YWI3YjI3IiwidXNlciI6jyJpZCI6eyIkb2lkIjoiNjAzZmMzOWQ4OWE2NjA0MTE1ZmZiM2NmIn0sImVtYWlsIjoiaGVscEBzdG9yZW1hbi5pbyJ9cRa"

Replace {space_id} with valid id of space you want to highlight. For example:

$ http GET https://app.storeman.io/api/spaces/6051c47c89a66065c5308d49/highlight \
  Authorization:"Bearer dyGraWQiCiJQd1JubTVvcFY0OUFfSmkyUnAxNHh6NjF5SHlpdU82dWI5blN3WFF5cHc0IiwiYWxnIjoibm9uZSJ9.eyJpc3MiOiJTdG9yZW1hbiIsImlhdCI6MTYyNDU3MjQ0MCwianRpIjoiZWE4NTgwNDYtZTk3Yi00ZGFmLWEzZDQtZmM1MjV1YWI3YjI3IiwidXNlciI6jyJpZCI6eyIkb2lkIjoiNjAzZmMzOWQ4OWE2NjA0MTE1ZmZiM2NmIn0sImVtYWlsIjoiaGVscEBzdG9yZW1hbi5pbyJ9cRa"

cURL:

$ curl -XGET https://app.storeman.io/api/spaces/6051c47c89a66065c5308d49/highlight \
  -H 'Authorization: Bearer dyGraWQiCiJQd1JubTVvcFY0OUFfSmkyUnAxNHh6NjF5SHlpdU82dWI5blN3WFF5cHc0IiwiYWxnIjoibm9uZSJ9.eyJpc3MiOiJTdG9yZW1hbiIsImlhdCI6MTYyNDU3MjQ0MCwianRpIjoiZWE4NTgwNDYtZTk3Yi00ZGFmLWEzZDQtZmM1MjV1YWI3YjI3IiwidXNlciI6jyJpZCI6eyIkb2lkIjoiNjAzZmMzOWQ4OWE2NjA0MTE1ZmZiM2NmIn0sImVtYWlsIjoiaGVscEBzdG9yZW1hbi5pbyJ9cRa'

If the access token is valid you should get something similar to the following result:

HTTP/1.1 204 No Content
Cache-Control: no-cache
Connection: keep-alive
Date: Sun, 27 Jun 2021 08:35:53 GMT
Referrer-Policy: strict-origin-when-cross-origin
Server: nginx/1.18.0 (Ubuntu)
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 32407175-c9e1-41d1-b1f7-a18353d7e0c8
X-Runtime: 0.256500
X-XSS-Protection: 1; mode=block