Have any questions?
+44 1234 567 890
Example of how to use the Charterware - API
more informations about the api under https://api.charterware.app/v1/
curl -X POST "https://api.charterware.app/v1/auth/login"\
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{ \"email\": \"test@charterware.local\", \"password\": \"123456\"}"
in case of success the following result is obtained
{
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjUxODUyNDgwLCJqdGkiOiJkY2Q0YTA1ZS03MGQ0LTRjZTItYjk1Yy01YzdkZGQ0ZDljNjkiLCJuYmYiOjE2NTE4NTI0ODAsInR5cGUiOiJhY2Nlc3MiLCJzdWIiOjIyLCJleHAiOjE2NTE4NTYwODAsImFjY2VzcyI6Ik9QRVJBVE9SIn0.8-AAyidLEYPMpNtLgPJuyC5_VWq5HPWUBc18IeH4ul8"
},
"message": "",
"code": 200
}
now insert the value from access_token here at "Authorization: Bearer {access_token}"
curl -X POST "https://api.charterware.app/v1/auth/me" -H "accept: application/json" -H "Authorization: Bearer {access_token}"
in case of success the following result is obtained
{
"data": {
"email": "test@charterware.local",
"role": "OPERATOR",
"packages": [
"Flight-Log",
"Track-Log",
"Tech-Log"
]
},
"message": "",
"code": 200
}
This determines which role the API user has and which packages he can retrieve. now the flight data can be retrieved
curl -X GET "https://api.charterware.app/v1/query/getFlights" -H "accept: application/json" -H "Authorization: Bearer {access_token}"
result
{
"uids": [
"D-TeSt-1_201909_160922"
],
"code": 200,
"message": ""
}
now the details of the flight can be called up as desired and according to the respective right
curl -X GET "https://api.charterware.app/v1/query/classic/D-TeSt-1_201909_160922" \
-H "accept: application/json" -H "Authorization: Bearer {access_token}"
the result
{
"block": {
"fdate": "2019-09-16",
"onmain": "2019-09-16T09:22:41Z",
"offmain": "2019-09-16T10:30:41Z",
"onengine": "2019-09-16T09:22:41Z",
"offengine": "2019-09-16T10:30:41Z",
"onblock": "2019-09-16T10:30:41Z",
"offblock": "2019-09-16T09:23:40Z",
"pilot1": "",
"pilot2": "",
"planecode": "D-TeSt-1",
"blocktime": "01:07:01",
"hardlanding": [
{
"datetime": "2019-09-16T10:30:35Z",
"lat": "47.859577",
"lon": "10.015825",
"alt": 639.799988,
"speed": 50,
"course": 231,
"specificenergy": 5.09241,
"droppingheight": 0.519104
}
],
"legs": [
{
"from": "EDNL",
"to": "EDNL",
"takeoff": "2019-09-16T09:27:41Z",
"nooflandings": 1,
"landing": "2019-09-16T10:30:35Z",
"legtime": "01:02:54"
}
]
},
"code": 200,
"message": "OK"
}
if you have now all data you have to confirm it with /query/ackFlights
Notice:
only then new flights can be retrieved via the API function /query/getFlights.