Get started
You will learn the basics of getting started on cloud.
Sign up for an account to start using Nextmv Cloud for optimizing routes for a fleet of vehicles.
Once you sign up, you will be able to access Nextmv Cloud API and Console (graphical user interface) to run a model, check the status of your run, and explore the results of a run.

Nextmv Cloud API

Nextmv Cloud API provides you with endpoints to run a model, check the status of your run, and get the results of a run. Follow the steps below to use Nextmv Cloud API.

Get an API key

After you have logged in to the Nextmv Cloud Console, go to the API page and click "Click to reveal API Key" under the header "Your API Key". The key will automatically be copied to your clipboard. Keep it safe, as it alone provides unfettered access to the cloud API.

Make a request

To make a request use the base URL, combined with one of the endpoint paths and headers specified below.
Text
1
https://api.cloud.nextmv.io/v0/{endpoint}
Copied!
Table: Available endpoints
Method
Endpoint
Description
POST
run
Create a new run
GET
{run id}/status
Get a run status
GET
{run id}/result
Get a run result

Add headers

Add the following headers to your request:
Header
Description
Accept: application/json
Request a JSON response
Authorization: Bearer {your API key}
Authorize the request
Content-Type: application/json
(for run) Request body is in JSON

Add request body

The request body must be written in JSON and follow the cloud input schema.

Get a response

Check on the status of your run via the {run id}/status endpoint. The API server should return something like the following.
JSON
1
{ "runID": "{your run ID}" }
Copied!
This means that an instance of Hop has been spun up to solve the model with the given input. The time it takes to finish execution varies by the size of the input and solver options. A successful run will result in the following response, once completed.
JSON
1
{ "status": "succeeded" }
Copied!

Retrieve a result

At this point, the result of your run is ready to be retrieved via the {run id}/result endpoint. It will look something like the sample output JSON below.
Modify the input of your run request to see how your result changes. If you have any questions or need help, please contact us at [email protected].
JSON
1
{
2
"hop": {
3
"version": "v0.7.2"
4
},
5
"options": {
6
"diagram": {
7
"expansion": {
8
"limit": 1
9
},
10
"restrictor": {
11
"type": "github.com/nextmv-io/code/hop/solve/diagram/restrict.value"
12
},
13
"width": 10
14
},
15
"limits": {
16
"duration": "3s"
17
},
18
"search": {
19
"buffer": 100,
20
"queuer": {
21
"type": "github.com/nextmv-io/code/hop/solve/queue.depth"
22
},
23
"searcher": {
24
"type": "github.com/nextmv-io/code/hop/solve/search.local"
25
}
26
},
27
"sense": "min"
28
},
29
"state": {
30
"vehicles": [
31
{
32
"id": "vehicle-1",
33
"value": 3682,
34
"travel_distance": 30824.842301505018,
35
"travel_time": 3682.4842301505028,
36
"route": [
37
{
38
"id": "vehicle-1-start",
39
"lon": -96.659222,
40
"lat": 33.122746,
41
"distance": 0,
42
"eta": "2021-10-17T09:00:00-06:00"
43
},
44
{
45
"id": "location-1",
46
"lon": -96.71038245222624,
47
"lat": 33.20580830033956,
48
"distance": 10391.50414831852,
49
"eta": "2021-10-17T09:17:19-06:00"
50
},
51
{
52
"id": "location-2",
53
"lon": -96.65613745932127,
54
"lat": 33.2259142720506,
55
"distance": 15910.82924812028,
56
"eta": "2021-10-17T09:28:31-06:00"
57
},
58
{
59
"id": "location-3",
60
"lon": -96.63759803136642,
61
"lat": 33.21528740544529,
62
"distance": 18001.39525293215,
63
"eta": "2021-10-17T09:34:00-06:00"
64
},
65
{
66
"id": "location-4",
67
"lon": -96.61356543957307,
68
"lat": 33.20379744909628,
69
"distance": 20576.530424227247,
70
"eta": "2021-10-17T09:40:17-06:00"
71
},
72
{
73
"id": "location-5",
74
"lon": -96.64137458150537,
75
"lat": 33.178801586789376,
76
"distance": 24374.092826725027,
77
"eta": "2021-10-17T09:48:37-06:00"
78
},
79
{
80
"id": "vehicle-1-end",
81
"lon": -96.659222,
82
"lat": 33.122746,
83
"distance": 30824.842301505018,
84
"eta": "2021-10-17T10:01:22-06:00"
85
}
86
]
87
},
88
{
89
"id": "vehicle-2",
90
"value": 5406,
91
"travel_distance": 48056.77689197839,
92
"travel_time": 5405.677689197839,
93
"route": [
94
{
95
"id": "vehicle-2-start",
96
"lon": -96.659222,
97
"lat": 33.122746,
98
"distance": 0,
99
"eta": "2021-10-17T09:00:00-06:00"
100
},
101
{
102
"id": "location-6",
103
"lon": -96.83157538607735,
104
"lat": 33.02896457334468,
105
"distance": 19147.828578821216,
106
"eta": "2021-10-17T09:31:54-06:00"
107
},
108
{
109
"id": "location-7",
110
"lon": -96.82951544963792,
111
"lat": 33.05170100884261,
112
"distance": 21683.286018576735,
113
"eta": "2021-10-17T09:38:08-06:00"
114
},
115
{
116
"id": "location-8",
117
"lon": -96.86007117348946,
118
"lat": 33.08133590083287,
119
"distance": 26038.292451410223,
120
"eta": "2021-10-17T09:47:23-06:00"
121
},
122
{
123
"id": "location-9",
124
"lon": -96.87346076034575,
125
"lat": 33.092841906114394,
126
"distance": 27825.176738548107,
127
"eta": "2021-10-17T09:52:22-06:00"
128
},
129
{
130
"id": "location-10",
131
"lon": -96.79586982112724,
132
"lat": 33.10492159118987,
133
"distance": 35176.62119033169,
134
"eta": "2021-10-17T10:06:37-06:00"
135
},
136
{
137
"id": "vehicle-2-end",
138
"lon": -96.659222,
139
"lat": 33.122746,
140
"distance": 48056.77689197839,
141
"eta": "2021-10-17T10:30:05-06:00"
142
}
143
]
144
}
145
],
146
"unassigned": [],
147
"value_summary": {
148
"value": 9088,
149
"total_travel_distance": 78881.6191934834,
150
"total_travel_time": 9088.161919348342,
151
"total_unassigned_penalty": 0
152
}
153
},
154
"statistics": {
155
"bounds": {
156
"lower": -9223372036854776000,
157
"upper": 9088
158
},
159
"search": {
160
"generated": 10,
161
"filtered": 0,
162
"expanded": 10,
163
"reduced": 0,
164
"restricted": 10,
165
"deferred": 10,
166
"explored": 0,
167
"solutions": 1
168
},
169
"time": {
170
"elapsed": "628.115µs",
171
"start": "2021-05-03T12:45:10.901164345Z"
172
},
173
"value": 9088
174
}
175
}
Copied!
Last modified 13d ago
Export as PDF
Copy link