Dipplanner REST API is a json API. All request and response MUST have a Content-Type: application/json
The whole API share the same error handling
This error is returned when the request did not use the application/json Content-Type.
ex:
$ curl -v -X GET http://127.0.0.1:8080/api/v1/mission/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
< Date: Mon, 01 Oct 2012 05:26:08 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 35
< Content-Type: application/json
<
* Closing connection #0
{"message": "400: Bad ContentType"}
This occurs when you try to use some method (GET, PUT, POST, PATCH, etc..) which is not defined in the API for this specific URI
ex:
returns a json object with all the content of the mission
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 05:27:31 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 8389
< Content-Type: application/json
<
and the result contains (for example)
{"dives": [{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 90.0, "time": 90.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 1200.0, "time": 1110.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1308.0, "time": 108.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1309.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1339.0, "time": 30.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1435.0, "time": 96.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1634.0, "time": 199.0, "type": "deco"}], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Dive to 30.0 for 1110.0s\n", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}, {"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 60.0, "time": 60.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 1800.0, "time": 1740.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1866.0, "time": 66.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1867.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1868.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1936.0, "time": 68.0, "type": "deco"}], "run_time": 1936.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}], "is_closed_circuit": false, "no_flight_time_value": 1860, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth"* Closing connection #0
: 20.0, "run_time": 0.0, "time": 1800.0, "type": "const"}], "metadata": "Dive to 20.0 for 1740.0s\n", "model": "ZHL16c", "surface_interval": 3600, "is_repetitive_dive": true}], "description": null}
creates a new mission object and loads the given mission details posted in the request.
Note
to be able to POST a mission, the current mission MUST be empty. you’ll probably need to call DELETE first.
if the request is accepted and correctly processed, the API will return 201 CREATED and the json dumps of the created mission
ex:
$ curl -v -X POST -d @/tmp/mission.json -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 8389
> Expect: 100-continue
>
* Done waiting for 100-continue
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 05:46:46 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 2814
< Content-Type: application/json
<
and the result contains (for example):
{"dives": [{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 454.3577760377562, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": false, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Dive to 30.0 for 1110.0s\n", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}, {"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [], "run_time": 1936.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.167344165* Closing connection #0
5867, "given_name": "Air", "min_gas": 454.3577760377562, "remaining_gas": 1791.9917863155865}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": false, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 0.0, "time": 1800.0, "type": "const"}], "metadata": "Dive to 20.0 for 1740.0s\n", "model": "ZHL16c", "surface_interval": 3600, "is_repetitive_dive": true}], "description": null}
this error is raised when you try to POST a new mission when the current mission is not empty : before posting a new mission structure, you MUST before call DELETE
ex:
$ curl -v -X POST -d @/tmp/mission.json -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/
* Could not resolve host: ; Erreur inconnue
* Closing connection #0
curl: (6) Could not resolve host: ; Erreur inconnue
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 403 Forbidden
< Date: Mon, 01 Oct 2012 05:33:05 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 90
< Content-Type: application/json
<
* Closing connection #0
{"message": "403: Forbidden: you MUST delete the current mission before create a new one"}
Updates the current Mission object because Mission is essentially a list a dives, it’s preferable to use POST on /mission/dives/ if you want to update the list of dives.
However, it’s still possible to use PATCH on /mission/ if you want. This method can also update the description of the mission
ex:
$ curl -v -X PATCH -d '{ "description": "coucou" }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 27
>
* upload completely sent off: 27 out of 27 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 16:16:18 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 8393
< Content-Type: application/json
<
with resulting content (for example, with empty dive list for readability)
{"dives": [], "description": "coucou"}
erase the current Mission if the delete operation succeed, the api returns 200 OK with an empty mission structure
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 05:39:01 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 32
< Content-Type: application/json
<
* Closing connection #0
{"dives": [], "description": ""}
returns the current status of the mission
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/status
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/status HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 05:54:48 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 28
< Content-Type: application/json
<
* Closing connection #0
{"status": "Not Calculated"}
return may be one of the following results :
{ 'status': 'Not Calculated' }
or:
{ 'status': 'Calculated but Changed' }
or:
{ 'status': 'Calculated and Up to date' }
Calculate all the dives of the mission
ex:
$ curl -v -X POST -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/calculate
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/calculate HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 06:11:50 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 39
< Content-Type: application/json
<
* Closing connection #0
{"status": "Calculated and Up to date"}
returns a json object with all the dives of the mission
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 05:27:31 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 8389
< Content-Type: application/json
<
and the result contains (for example)
{"dives": [{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 90.0, "time": 90.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 1200.0, "time": 1110.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1308.0, "time": 108.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1309.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1339.0, "time": 30.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1435.0, "time": 96.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1634.0, "time": 199.0, "type": "deco"}], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Dive to 30.0 for 1110.0s\n", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}, {"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 60.0, "time": 60.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 1800.0, "time": 1740.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1866.0, "time": 66.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1867.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1868.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1936.0, "time": 68.0, "type": "deco"}], "run_time": 1936.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}], "is_closed_circuit": false, "no_flight_time_value": 1860, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 0.0, "time": 1800.0, "type": "const"}], "metadata": "Dive to 20.0 for 1740.0s\n", "model": "ZHL16c", "surface_interval": 3600, "is_repetitive_dive": true}]}
add a dive in the mission the dive can be an empty dive if not data is sended with the POST. if data is sent, dipplanner will try to configure the dive with the datas
returns json structure of the created dive
ex 1 (with no data):
$ curl -v -X POST -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 15:24:40 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 300
< Content-Type: application/json
<
* Closing connection #0
{"current_depth": 0.0, "pp_o2": 0.0, "current_tank": {}, "output_segments": [], "run_time": 0, "tanks": [], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": false, "input_segments": [], "metadata": "", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}
ex 2 (with dive data):
$ curl -v -X POST -d @/tmp/dive1.json -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/ > /tmp/created_dive1.json
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 4392
> Expect: 100-continue
>
* Done waiting for 100-continue
0 4392 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0} [data not shown]
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 15:28:03 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 1388
< Content-Type: application/json
<
{ [data not shown]
100 5780 100 1388 100 4392 1370 4335 0:00:01 0:00:01 --:--:-- 4339
* Closing connection #0
with the sended data:
{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 454.3577760377562, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": false, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Dive to 30.0 for 1110.0s\n", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}
delete all the dives of the mission
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 07:33:00 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 13
< Content-Type: application/json
<
* Closing connection #0
{"dives": []}
returns a json object with the content of a specific dive
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 07:10:17 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 4392
< Content-Type: application/json
<
and the result contains (for example) :
{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 90.0, "time": 90.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 1200.0, "time": 1110.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1308.0, "time": 108.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1309.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1339.0, "time": 30.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1435.0, "time": 96.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1634.0, "time": 199.0, "type": "deco"}], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Dive to 30.0 for 1110.0s\n", "model": "ZHL16c", "surface_interval": 0, "is_repetitive_dive": false}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 07:13:25 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
Update a parameter for this specific dive. If a parameter is a list of objects (like tanks, and segments), the entire list will be overwritten by the PATCH method
ex : file /tmp/modified_dive1.json contains:
{"metadata": "Coucou", "model": "ZHL16B", "surface_interval": 1664, "is_repetitive_dive": true}
$ curl -v -X PATCH -d @/tmp/created_dive1.json -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/3 > /tmp/patched_dive3.json
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/3 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 1370
> Expect: 100-continue
>
* Done waiting for 100-continue
0 1370 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0} [data not shown]
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 15:51:35 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 1370
< Content-Type: application/json
<
{ [data not shown]
100 2740 100 1370 100 1370 1355 1355 0:00:01 0:00:01 --:--:-- 1356
* Closing connection #0
which returns (for example):
{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [], "run_time": 1634.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 454.3577760377562, "remaining_gas": 1859.2695968655864}], "is_closed_circuit": false, "no_flight_time_value": null, "in_final_ascent": false, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}], "metadata": "Coucou", "model": "ZHL16c", "surface_interval": 1664, "is_repetitive_dive": true}
We can see in this example that “model” was not updated, because the given value is not a valid value. The API currently silently errors and update only valid value.
This behaviour may change in the future.
delete a specific dive and returns the list of remaining dives
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 07:34:13 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 3974
< Content-Type: application/json
<
and the request content will be (for example):
{"dives": [{"current_depth": 0, "pp_o2": 0.0, "current_tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 60.0, "time": 60.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 1800.0, "time": 1740.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1866.0, "time": 66.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1867.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1868.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1936.0, "time": 68.0, "type": "deco"}], "run_time": 1936.0, "tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}], "is_closed_circuit": false, "no_flight_time_value": 1860, "in_final_ascent": true, "input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 20.0, "run_time": 0.0, "time": 1800.0, "type": "const"}], "metadata": "Dive to 20.0 for 1740.0s\n", "model": "ZHL16c", "surface_interval": 3600, "is_repetitive_dive": true}]}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 07:36:11 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
returns the list of tanks for a specific dive
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 17:06:31 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 328
< Content-Type: application/json
<
* Closing connection #0
{"tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}]}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 17:09:05 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
add a tank to this dive
Returns the json dump of the newly created Tank
ex:
$ curl -v -X POST -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 17:22:06 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 301
< Content-Type: application/json
<
* Closing connection #0
{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 12.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 200.0, "name": "Air", "f_he": 0.0, "used_gas": 0.0, "total_gas": 2423.0970252848065, "given_name": "Air", "min_gas": 363.48622083020496, "remaining_gas": 2423.0970252848065}
ex2 (creation of a nitrox tank):
$ curl -v -X POST -d '{"tank_rule": "50b", "f_n2": 0.7, "tank_vol": 12.0, "f_o2": 0.3, "tank_pressure": 230.0, "f_he": 0.0, "mod": "auto" }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 117
>
* upload completely sent off: 117 out of 117 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 17:28:58 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 304
< Content-Type: application/json
<
* Closing connection #0
{"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.7, "tank_vol": 12.0, "f_o2": 0.3, "mod": 43, "tank_pressure": 230.0, "name": "Nitrox 30", "f_he": 0.0, "used_gas": 0.0, "total_gas": 2741.1341414852973, "given_name": "Air", "min_gas": 615.1818387539787, "remaining_gas": 2741.1341414852973}
Note
There is a special feature about MOD : in the json structure, when creating tanks, you can specify the MOD in meter, but you can also ask dipplanner to calculate MOD automatically based on max_ppo2 with the json parameter: { “mod”: “auto” } If not given, dipplanner will use the default MOD (for air) and may raise and error if you’re try to create a tank with a shallower MOD
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X POST -d '{"tank_rule": "50b", essure": 230.0, "f_he": 0.0 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/42/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 102
>
* upload completely sent off: 102 out of 102 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 17:38:39 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
If the given parameter are wrong and does not permits the creation of the tank, dipplanner will return error 500 with the reason of the error
ex:
$ curl -v -X POST -d '{"tank_rule": "50b", "f_n2": 0.7, "tank_vol": 12.0, "f_o2": 0.3, "tank_pressure": 230.0, "f_he": 0.0 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 102
>
* upload completely sent off: 102 out of 102 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Mon, 01 Oct 2012 17:40:17 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 52
< Content-Type: application/json
<
* Closing connection #0
{"message": "500: MOD exceed maximum tolerable MOD"}
ex2:
$ curl -v -X POST -d '{"tank_rule": "50b", "f_n2": 0.7, "tank_vol": 12.0, "f_o2": 0.5, "tank_pressure": 230.0, "f_he": 0.0 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 102
>
* upload completely sent off: 102 out of 102 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Mon, 01 Oct 2012 17:40:44 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 54
< Content-Type: application/json
<
* Closing connection #0
{"message": "500: Proportion of O2+He+N2 is not 100%"}
delete all the tanks of this dive returns the new list of tanks (empty list in this case)
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 17:55:48 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 13
< Content-Type: application/json
<
* Closing connection #0
{"tanks": []}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/42/tanks/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 17:59:08 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
returns a specific tank for a specific dive
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 17:08:03 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 315
< Content-Type: application/json
<
* Closing connection #0
{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}
If the given dive_id or the given tank_id is not found, the API will return a simple 404:
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 17:09:51 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/tanks/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 17:10:29 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 39
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: tank (42) not found"}
Update parameter(s) for this specific tank.
ex 1: change the tank rule from “30b” to “50b”
$ curl -v -X PATCH -d '{"tank_rule":"50b"}' -H "Content-type: application/json" http://11:8080/api/v1/mission/dives/1/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 19
>
* upload completely sent off: 19 out of 19 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 18:09:07 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 315
< Content-Type: application/json
<
* Closing connection #0
{"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1527.8977473000002, "total_gas": 3387.1673441655867, "given_name": "Air", "min_gas": 767.5548028677879, "remaining_gas": 1859.2695968655864}
If the given dive_id or the given tank_id is not found, the API will return a simple 404:
ex:
$ curl -v -X PATCH -d '{"tank_rule":"50b"}' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/42/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 19
>
* upload completely sent off: 19 out of 19 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 18:10:39 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X PATCH -d '{"tank_rule":"50b"}' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/tanks/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 19
>
* upload completely sent off: 19 out of 19 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 18:11:22 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: tank_id (42) not found"}
If the given parameter are wrong and does not permits the creation of the tank, dipplanner will return error 500 with the reason of the error
ex:
$ curl -v -X PATCH -d '{"tank_rule":"50b", "f_o2": 0.66, "f_n2": 0.34}' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 47
>
* upload completely sent off: 47 out of 47 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Mon, 01 Oct 2012 19:12:56 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 52
< Content-Type: application/json
<
* Closing connection #0
{"message": "500: MOD exceed maximum tolerable MOD"}
ex2:
$ curl -v -X PATCH -d '{"tank_rule":"50b", "f_o2": 0.66}' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 33
>
* upload completely sent off: 33 out of 33 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Mon, 01 Oct 2012 19:12:02 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 54
< Content-Type: application/json
<
* Closing connection #0
{"message": "500: Proportion of O2+He+N2 is not 100%"}
delete the given tank returns the list of remaining tanks in this dive
ex (starting with a list of 3 AirTanks):
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 17:57:58 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 617
< Content-Type: application/json
<
* Closing connection #0
{"tanks": [{"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 12.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 200.0, "name": "Air", "f_he": 0.0, "used_gas": 0.0, "total_gas": 2423.0970252848065, "given_name": "Air", "min_gas": 363.48622083020496, "remaining_gas": 2423.0970252848065}, {"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 12.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 200.0, "name": "Air", "f_he": 0.0, "used_gas": 0.0, "total_gas": 2423.0970252848065, "given_name": "Air", "min_gas": 363.48622083020496, "remaining_gas": 2423.0970252848065}]}
If the given dive_id or if the tank_id is not found, the API will return a simple 404:
ex 1:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/tanks/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/42/tanks/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 18:00:07 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/tanks/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/tanks/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 18:00:41 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 39
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: tank (42) not found"}
returns the list of input segments for a specific dive
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:02:47 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 443
< Content-Type: application/json
<
* Closing connection #0
{"input_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}]}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:04:02 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
add an input_segment to this dive
Returns the json dump of the newly created Segment
ex:
$ curl -v -X POST -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 21:15:07 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 106
< Content-Type: application/json
<
* Closing connection #0
{"tank": {}, "in_use": true, "setpoint": 0.0, "depth": 0.0, "run_time": 0.0, "time": 0.0, "type": "const"}
ex 2:
$ curl -v -X POST -d '{ "tank": {}, "depth": 25, "time": 2000}' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/1/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 40
>
* upload completely sent off: 40 out of 40 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 201 Created
< Date: Mon, 01 Oct 2012 21:14:19 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 405
< Content-Type: application/json
<
* Closing connection #0
{"tank": {"tank_rule": "30b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 12.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 200.0, "name": "Air", "f_he": 0.0, "used_gas": 0.0, "total_gas": 2423.0970252848065, "given_name": "Air", "min_gas": 363.48622083020496, "remaining_gas": 2423.0970252848065}, "in_use": true, "setpoint": 0.0, "depth": 25, "run_time": 0.0, "time": 2000, "type": "const"}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X POST -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /api/v1/mission/dives/42/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:05:07 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
delete all the input_segments of this dive returns the new list of input_segments (empty list in this case)
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/apis/1/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:23:33 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 22
< Content-Type: application/json
<
* Closing connection #0
{"input_segments": []}
If the given dive_id is not found, the API will return a simple 404:
ex:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/42/input_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:24:02 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
returns a specific input_segment for a specific dive
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:25:58 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 427
< Content-Type: application/json
<
* Closing connection #0
{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 0.0, "time": 1200.0, "type": "const"}
If the given dive_id or the given segment_id is not found, the API will return a simple 404:
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:26:45 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/input_segments/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:27:10 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: segment (42) not found"}
Update parameter(s) for this specific input_segment.
ex: change the depth from 30m to 45m
$ curl -v -X PATCH -d '{ "depth": 45 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 15
>
* upload completely sent off: 15 out of 15 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:32:34 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 425
< Content-Type: application/json
<
* Closing connection #0
{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 45, "run_time": 0.0, "time": 1200.0, "type": "const"}
If the given dive_id or the given segment_id is not found, the API will return a simple 404:
ex:
$ curl -v -X PATCH -d '{ "depth": 45 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/42/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 15
>
* upload completely sent off: 15 out of 15 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:34:06 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X PATCH -d '{ "depth": 45 }' -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/mission/dives/1/input_segments/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
> Content-Length: 15
>
* upload completely sent off: 15 out of 15 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:34:36 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 45
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: segment_id (42) not found"}
delete the given input_segment returns the list of remaining input_segments in this dive
ex (starting with a list of 4 input_segments):
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:36:55 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 344
< Content-Type: application/json
<
* Closing connection #0
{"input_segments": [{"tank": {}, "in_use": true, "setpoint": 0.0, "depth": 0.0, "run_time": 0.0, "time": 0.0, "type": "const"}, {"tank": {}, "in_use": true, "setpoint": 0.0, "depth": 0.0, "run_time": 0.0, "time": 0.0, "type": "const"}, {"tank": {}, "in_use": true, "setpoint": 0.0, "depth": 0.0, "run_time": 0.0, "time": 0.0, "type": "const"}]}
If the given dive_id or if the segment_id is not found, the API will return a simple 404:
ex 1:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/input_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/42/input_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:37:42 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X DELETE -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/input_segments/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /api/v1/mission/dives/1/input_segments/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:38:03 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: segment (42) not found"}
Output segments are the result of the calculations, so they are read-only
return the calculated output_segments
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/output_segments/ > /tmp/output_segs.json
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/output_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:50:01 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 3028
< Content-Type: application/json
<
{ [data not shown]
100 3028 100 3028 0 0 1287k 0 --:--:-- --:--:-- --:--:-- 1478k
* Closing connection #0
{"output_segments": [{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 90.0, "time": 90.0, "type": "descent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 1200.0, "time": 1110.0, "type": "const"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1308.0, "time": 108.0, "type": "ascent"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 12.0, "run_time": 1309.0, "time": 1.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 9.0, "run_time": 1339.0, "time": 30.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 6.0, "run_time": 1435.0, "time": 96.0, "type": "deco"}, {"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 3.0, "run_time": 1634.0, "time": 199.0, "type": "deco"}]}
If the given dive_id is not found, the API will return a simple 404:
ex 1:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/output_segments/
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/output_segments/ HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:54:52 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
Output segments are the result of the calculations, so they are read-only
return a specific output segment
ex:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/output_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/output_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 01 Oct 2012 21:51:27 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 428
< Content-Type: application/json
<
* Closing connection #0
{"tank": {"tank_rule": "50b", "max_ppo2": 1.6, "in_use": true, "f_n2": 0.79, "tank_vol": 15.0, "f_o2": 0.21, "mod": 66, "tank_pressure": 230.0, "name": "Air", "f_he": 0.0, "used_gas": 1595.1755578500001, "total_gas": 3387.1673441655867, "given_name": "airtank", "min_gas": 767.5548028677879, "remaining_gas": 1791.9917863155865}, "in_use": true, "setpoint": 0.0, "depth": 30.0, "run_time": 90.0, "time": 90.0, "type": "descent"}
If the given dive_id or if the segment_id is not found, the API will return a simple 404:
ex 1:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/42/output_segments/1
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/42/output_segments/1 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:55:16 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: dive_id (42) not found"}
ex 2:
$ curl -v -X GET -H "Content-type: application/json" http://127.0.0.1:8080/api/v1/mission/dives/1/output_segments/42
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /api/v1/mission/dives/1/output_segments/42 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-type: application/json
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 Not Found
< Date: Mon, 01 Oct 2012 21:55:45 GMT
< Server: WSGIServer/0.1 Python/2.7.3
< Content-Length: 42
< Content-Type: application/json
<
* Closing connection #0
{"message": "404: segment (42) not found"}