Barriers

Get all barriers

Enables you to get all barriers according to the specified parameters. Support requests: GET & POST;

POST SERVER_URL/barrier/viewAll?userHash={userHash}&sublocationId={sublocationId}

Parameters

Parameter Value
{userHash}

hash of the registered user

0000-0000-0000-0000 - for locations with the public_location flag

{sublocationId} ID of the specific sublocation (map), for which you create the barrier.

Add New Barrier

Enables you to add a new barrier according to the specified parameters. Support requests: only POST;

POST SERVER_URL/barrier/draw?userHash={userHash}&sublocationId={sublocationId}

Request Parameters

Parameter Value
{userHash}

hash of the registered user

0000-0000-0000-0000 - for locations with the public_location flag

{sublocationId} ID of the specific sublocation (map), for which you create the barrier.

Body form-data parameters

Parameter Value
{objectType} Object type. For barriers this value is 1.
{barrier} New barrier data

JSON Request Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
[
  objectType: 1,
  barrier: {
    "id": 0, // Specify 0 to create a new barrier
    "type":"barrier", // Type of the object, which is barrier in this case.
    "points":[ // List of reference points that determine the barrier borders. Specify the X and coordinates.
      {
        "x":"126.7",
        "y":"289.7"
      },
      {
        "x":"342.7",
        "y":"1523.7"
      },
      {
        "x":"1233.7",
        "y":"945.7"
      }
    ]
  }
]

JSON Response Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[
    {
      "response": "ok", // Request result.
      "id": 42, // Barrier ID
      "type": "barrier", // Object type
      "points": [ // Reference points
        {
          "id": 98,
          "x": 126.7,
          "y": 289.7,
          "geo": { // GPS coordinates, empty if nothing specified at the creation stage
            "lat": "",
            "long": ""
          }
        },
        {
          "id": 96,
          "x": 342.7,
          "y": 1523.7,
          "geo": {
            "lat": "",
            "long": ""
          }
        },
        {
          "id": 97,
          "x": 1233.7,
          "y": 945.7,
          "geo": {
            "lat": "",
            "long": ""
          }
        }
      ]
    }
]

Editing Barriers

Enables you to edit an existing barrier. Support requests: only POST;

POST SERVER_URL/barrier/edit?userHash={userHash}&sublocationId={sublocationId}

Request Parameters

Parameter Value
{userHash}

hash of the registered user

0000-0000-0000-0000 - for locations with the public_location flag

{sublocationId} ID of the specific sublocation (map), for which you create the barrier.

Body form-data parameters

Parameter Value
{id} ID of the barrier that you want to edit. Has JSON format
{barrier} Barrier data that you want to edit.

Editing request is similar to creating new barrier, while in case of editing a barrier, you remove elements or update the existing entries.

JSON Request Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[
    {
      "id": 638330, // ID of the sublocation for which you're editing the barrier
      "barrier": [
        {
          "type": "barrier",
          "points":[
            {
              "x":0.0,
              "y":0.0,
              "id": 1191168,
              "action":"update"
            },{
              "x":0.0,
              "y":0.0,
              "id": 1191169,
              "action":"update"
              },{
                "x":0.0,
                "y":0.0,
                "id":1191170 ,
                "action":"update"
                }
          ]
        }
      ]
    }
]

JSON Response Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[
  {
    "response": "ok",
    "id": 42,
    "type": "barrier",
    "points": [
      {
        "id": 98,
        "x": 126.69999928,
        "y": 289.69999824,
        "geo": {
          "lat": "",
          "long": ""
        }
      }
    ]
  }
]

Deleting Barriers

Enables you to remove an existing barrier. Support requests: GET & POST;

POST SERVER_URL/barrier/delete?userHash={userHash}&sublocationId={sublocationId}&barrierId={barrierId}

Request Parameters

Parameter Value
{userHash}

hash of the registered user

0000-0000-0000-0000 - for locations with the public_location flag

{sublocationId} ID of the sublocation (map).
{barrierId} ID of the specific sublocation (map), for which you delete the barrier.

JSON Response Example

1
2
3
4
5
6
7
[
    {
      "response": "ok",
      "type": "barrier",
      "msg": "the barrier deleted"
    }
]