Skip to content

Commit 23d0bbc

Browse files
committed
add an example for closing VMX sessions
1 parent ca5ef79 commit 23d0bbc

1 file changed

Lines changed: 52 additions & 12 deletions

File tree

docs/VMXapi.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VMX API
22

3-
VMX runs as a server and processes requests over HTTP.
3+
VMX runs as a server and processes object detection requests over HTTP.
44

55
---
66

@@ -157,7 +157,6 @@ The output will give us a new session id.
157157

158158
**Output**
159159
```
160-
161160
{ "data": {
162161
"id": "15c3a5dc-cffb-43ac-a5dd-6755f5376c81"
163162
}
@@ -177,19 +176,19 @@ curl -s localhost:3000/session | jq .
177176
"data": [
178177
{
179178
"model": {
180-
"image": "models/1ad3282b-3fce-4f56-ae90-2a4d16d2f40d/image.jpg",
181-
"num_pos": 200,
182-
"num_neg": 200,
179+
"image": "models/e018112b-c9ba-437f-959d-49280acb8c9c/image.jpg",
180+
"num_pos": 882,
181+
"num_neg": 360,
183182
"size": [
184-
10,
183+
4,
185184
10
186185
],
187-
"uuid": "1ad3282b-3fce-4f56-ae90-2a4d16d2f40d",
188-
"name": "open_mouth",
189-
"start_time": "2015-04-15T02:58:01.115Z",
190-
"end_time": "2015-04-15T06:55:53.230Z"
186+
"uuid": "e018112b-c9ba-437f-959d-49280acb8c9c",
187+
"name": "eyes",
188+
"start_time": "2015-03-16T04:29:36.921Z",
189+
"end_time": "2015-04-15T07:36:46.837Z"
191190
},
192-
"id": "24f362c8-75aa-43ca-8fc3-f9ceeaf5cef0"
191+
"id": "61634995-b25c-4271-b1e5-d3925f49957f"
193192
}
194193
]
195194
}
@@ -200,7 +199,7 @@ the "eyes" detection. We will be using the following image:
200199

201200
[http://people.csail.mit.edu/tomasz/img/tomasz_blue_crop.jpg](http://people.csail.mit.edu/tomasz/img/tomasz_blue_crop.jpg)
202201

203-
<img src="http://people.csail.mit.edu/tomasz/img/tomasz_blue_crop.jpg"></img>
202+
<img src="/img/tomasz_blue_crop.jpg"></img>
204203

205204
**Command line input**
206205
```
@@ -246,6 +245,47 @@ detector, sent it the location of an image, and obtained the resulting
246245
JSON which shows the location of the object as well as the resulting
247246
confidence score.
248247

248+
Let's now close our running session.
249+
250+
## Example 2: Close a running session
251+
252+
Let's check the number of running sessions:
253+
254+
**Input**
255+
```
256+
curl -s http://localhost:3000/session | jq '.data | length'
257+
```
258+
259+
**Command line output**
260+
```
261+
1
262+
```
263+
264+
Let's get the session id of the first and only running session.
265+
266+
```
267+
SID=`curl -s http://localhost:3000/session | jq -r '.data[0].id'`
268+
```
269+
And finally let's close the session by sending the DELETE verb to the
270+
session we assigned to the environment variable $SID.
271+
272+
```
273+
curl -s -X DELETE http://localhost:3000/session/$SID
274+
```
275+
276+
We can now confirm that the number of sessions is 0.
277+
278+
**Input**
279+
```
280+
curl -s http://localhost:3000/session | jq '.data | length'
281+
```
282+
283+
**Command line output**
284+
```
285+
0
286+
```
287+
288+
249289

250290
---
251291

0 commit comments

Comments
 (0)