Routes

Drawing Routes

Enables you to draw a new route or modify reference points of an existing route. Support requests: only POST;

POST SERVER_URL/route/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 route.
{objectType} Object type. For routes this value is 3.

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
{
            "action": "save", // Type of the action. In this case you save the points described in the "points" section of the array.
            "id": 0, // Route's ID. Specify 0 if you are creating a new route.
            "direction": 3, // 1: start to end point, 2: end to start point, 3: in both directions
            "weight": 1, // Route priority
            "points": [ // Full list if points included into the route with their coordinates.
                    {
                            "id": 0, // If you specify new (unused) IDs - new points will be created for the sublocation. Refer to Editing Routes in this document (below) for info on updating the existing points
                            "x": "1282", // X coordinate in the sublocation
                            "y": "1282" // Y coordinate in the sublocation
        }
    ]
},
{
            "action": "delete", // Delete reference points specified below.
    "id": 123, // Specify ID of a route for which you want to remove reference points.
    "points": [
                    {
                            "id": 123
        }
    ]
},

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
37
38
39
40
41
42
43
44
{
            "response": "ok",
    "type": "route",
    "objects": [
                    {
                            "id": 85064,
                            "type": "route",
                            "routes": {
                                    "id": 82617,
                                    "direction": 3,
                                    "weight_forward": "1.00000000",
                                    "weight_backward": "1.00000000",
                                    "points": [
                                            {
                                                    "id": 101977,
                                                    "title": null,
                                                    "is_elevation": null,
                                                    "x": 481.9999964,
                                                    "y": 123.0000022
                                            }
                                    ]
                            }
        },
        {
                            "id": 85065,
                            "type": "route",
                            "routes": {
                                    "id": 82618,
                                    "direction": 3,
                                    "weight_forward": "1.00000000",
                                    "weight_backward": "1.00000000",
                                    "points": [
                                            {
                                                    "id": 101979,
                                                    "title": null,
                                                    "is_elevation": null,
                                                    "x": 11.99999284,
                                                    "y": 794.99999747
                                            }
                                    ]
                            }
        }
      ]
}

Editing Routes

Enables you to edit an existing route parameters (not its reference points). Support requests: only POST;

POST SERVER_URL/route/edit?userHash={userHash}&routeId={routeId}&sublocationId={sublocationId}

Request Parameters

Parameter Value
{userHash} hash of the registered user
{sublocationId} ID of the specific sublocation (map), for which you create the route.
{routeId} ID of the route that you want to edit.

Body form-data parameters

Parameter Value
{direction} Route direction.
{weight_forward} Increase weight of a route by n.
{weight_backward} Decrease weight of a route by n.

JSON Request Example

1
2
3
4
5
6
{
    "id": 123, // ID of the route that you want to edit
    "direction": 3, // 1: start to end point, 2: end to start point, 3: in both directions
    "weight_forward": 3, // Route priority in the forward direction
    "weight_backward": 1 // Route priority in the backward direction
}

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
{
    "response": "ok",
    "id": 60900,
    "type":"route",
    "routes":[
        {
                            "id":123,
                            "direction":3,
                            "weight_forward":3,
                            "weight_backward":1,
                            "points":[
                                    {
                                            "id":896858,
                                            "title":"",
                                            "is_elevation":false,
                                            "x":"1282",
                                            "y":"1282"
                                    },
                                    {
                                            "id":896858,
                                            "title":"",
                                            "is_elevation":false,
                                            "x":"1282",
                                            "y":"1282"
                                    }
                            ]
        }
    ]
}

Removing Routes

Enables you to edit an existing route. Support requests: GET & POST;

POST SERVER_URL/route/delete?userHash={userHash}&sublocationId={sublocationId}&routeId={routeId}

Request Parameters

Parameter Value
{userHash} hash of the registered user
{sublocationId} ID of the specific sublocation (map), for which you create the route.
{routeId} ID of the route that you want to remove.

JSON Response Example

1
2
3
4
5
{
    "response": "ok",
    "type": "route",
    "msg": "the route deleted"
}