Jump to content

Info on VATSIM API


Recommended Posts

What is VATSIM API?

VATSIM API (https://api.vatsim.net/api/) is a replacement of the old CERT API & AutoTools. It's a set of RESTful JSON endpoints designed to replace the following AutoTools / CERT API endpoints

  • idstatusint, idstatusprev, idstatusrat
  • ratch.php
  • divdbwfullpilot
  • divdb
  • rating.php
  • vaccdb

In time, as development progresses and once users have migrated to this new service, AutoTools & CERT API will be deprecated.

We offer a Swagger browser and some examples are available below. Using Swagger is the best way to learn about all of the endpoints. This forum thread is non-exhaustive.

  • Thanks 1
Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites

Viewing the details of a user. Time spent on ATC positions, last connections, member details.
idstatusint.php replacement

Issue a GET request to https://api.vatsim.net/api/ratings/$CID/ or  https://api.vatsim.net/api/ratings/$CID/rating_times/ OR  https://api.vatsim.net/api/ratings/$CID/connections/

Returned Response:

JSON object containing the following fields: id, rating, pilotrating, name_first, name_last, age, countystate, country, susp_date, reg_date, region, division, subdivision

Example:

curl -H 'Accept: application/json; indent=4' "https://api.vatsim.net/api/ratings/1475625/"

Example Response:

{
    "id": "1475625",
    "rating": 1,
    "pilotrating": 0,
    "name_first": "Ryan",
    "name_last": "Bentley",
    "age": 4,
    "countystate": "Lancashire",
    "country": "GB",
    "susp_date": null,
    "reg_date": "2020-01-18T22:17:02",
    "region": "EUR",
    "division": "GBR",
    "subdivision": ""
}

This endpoint will only return JSON.

Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites

Updating User
ratch.php replacement

If you have a token with division roles:

Issue a PATCH request to https://api.vatsim.net/api/ratings/$CID/

Accepts: JSON with the following optional fields: 

  • rating (int)
  • division (str)
  • subdivision (str)

Fields are available based on what type of token access you have been given.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Token 7796bdb6b0be14ccf3f147036e133f1719d4712b" "https://api.vatsim.net/api/ratings/1475625/" -d "{
"subdivision": "SCA"
}"

Example Response:

{"status": "user updated"}

This endpoint will only return JSON.

Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites
  • Ryan pinned and locked this topic

Add Comment
Append a comment to a members profile

If you have a token with the add_comment role:

Issue a POST request to https://api.vatsim.net/api/ratings/$CID/add_comment/

Accepts: JSON with the following optional fields: rating, subdivision

  • comment (str)
  • type (int)

Valid Types: 

[8, 9, 10, 12, 14, 15, 17, 18, 21]

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Token 7796bdb6b0be14ccf3f147036e133f1719d4712b" "https://api.vatsim.net/api/ratings/1475625/add_comment/" -d "{
"comment": "Test Comment", "type": 3
}"

Example Response:

{"status": "comment added"}

This endpoint will only return JSON.

Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites
  • 2 weeks later...

Viewing all of the members in your region, division, subdivision
divdb replacement

Issue a GET request to one of these URLS:

https://api.vatsim.net/api/regions/<region_id>/members/
https://api.vatsim.net/api/divisions/<division_id>/members/
https://api.vatsim.net/api/subdivisions/<subdivision_id>/members/

You must have the correct token permissions to use these endpoints.

Returned Response:

JSON object containing the following fields: id, rating, pilotrating, name_first, name_last, age, countystate, country, susp_date, reg_date, region, division, subdivision

Example:

curl -H 'Accept: application/json; indent=4' -H "Authorization: Token 7796bdb6b0be14ccf3f147036e133f1719d4712b" "https://api.vatsim.net/api/divisions/test/members/"

Example Response:

[
    {
        "id": "1115151",
        "rating": 1,
        "pilotrating": 0,
        "name_first": "Test",
        "name_last": "User",
        "age": 3,
        "countystate": "",
        "country": null,
        "susp_date": "2020-04-24T23:16:15",
        "reg_date": "2020-03-13T19:51:02",
        "region": "USA-N",
        "division": "IDK",
        "subdivision": ""
    },
    {
        "id": "1475625",
        "rating": 5,
        "pilotrating": 0,
        "name_first": "7",
        "name_last": "R",
        "age": 3,
        "countystate": "",
        "country": "",
        "susp_date": "2020-03-21T16:28:14",
        "reg_date": "2020-03-13T19:51:02",
        "region": "USA-N",
        "division": "IDK",
        "subdivision": ""
    }
]

This endpoint will only return JSON.

  • Thanks 1
Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites
  • 1 month later...

Viewing all of the ATC Sessions of a member
Issue a GET request to one of these URLS:

https://api.vatsim.net/api/ratings/<cid>/atcsessions/

You can search for different callsign or position types too like this:

https://api.vatsim.net/api/ratings/<cid>/atcsessions/TWR/
https://api.vatsim.net/api/ratings/<cid>/atcsessions/EGKK/

Examples:

https://api.vatsim.net/api/ratings/1375048/atcsessions/LSGG/

You can now view by facility type, eg: https://api.vatsim.net/api/ratings/1240411/atcsessions/EGLL_APP/ - this will show things like EGLL_N_APP, EGLL_S_APP, EGLL_APP

You can also just query by type: https://api.vatsim.net/api/ratings/1240411/atcsessions/APP/

You can add either the "date" or "start" parameter to the query.

https://api.vatsim.net/api/ratings/1240411/atcsessions/EGLL_APP/?date=2020-09-18 - this will show any EGLL_APP position controlled on that date
https://api.vatsim.net/api/ratings/1240411/atcsessions/EGLL_APP/?start=2020-09-18 - this will show any EGLL_APP position controlled on or after that date.

Use ?page_size=N to manage the length of each page returned. IE: https://api.vatsim.net/api/ratings/1375048/atcsessions/LSGG/?page_size=10?page_size=10

This is a public endpoint that does not require an authentication token

Returned Response:

JSON object containing the following fields: id, rating, pilotrating, name_first, name_last, age, countystate, country, susp_date, reg_date, region, division, subdivision

Example:

curl -H 'Accept: application/json; indent=4' "https://api.vatsim.net/api/ratings/1115151/atcsessions/"

Example Response:

{
    "count": 24,
    "next": "https://api.vatsim.net/api/ratings/1115151/atcsessions/?page=2&page_size=10",
    "previous": null,
    "results": [
        {
            "connection_id": 24311588,
            "start": "2010-06-27T20:50:23",
            "end": "2010-06-28T00:13:37",
            "server": "USA-N",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "203.233333",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 60,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 24246771,
            "start": "2010-06-21T01:52:25",
            "end": "2010-06-21T02:24:05",
            "server": "USA-N",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "31.666667",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 18,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23859859,
            "start": "2010-05-14T14:22:20",
            "end": "2010-05-14T14:33:30",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "11.166667",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 2,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23846258,
            "start": "2010-05-13T00:03:24",
            "end": "2010-05-13T00:47:08",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "43.733333",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 4,
            "flightsamended": 8,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 4,
            "cruisealtsmodified": 2,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23846215,
            "start": "2010-05-12T23:58:58",
            "end": "2010-05-13T00:03:22",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "4.4",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 4,
            "flightsamended": 2,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 1,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23846158,
            "start": "2010-05-12T23:50:40",
            "end": "2010-05-12T23:58:55",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "8.25",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 1,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23846036,
            "start": "2010-05-12T23:34:29",
            "end": "2010-05-12T23:50:37",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "16.133333",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 4,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 1,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23837439,
            "start": "2010-05-11T23:58:03",
            "end": "2010-05-12T00:49:13",
            "server": "USA-E",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "51.166667",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 3,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 1,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23767272,
            "start": "2010-05-04T23:35:06",
            "end": "2010-05-05T01:37:16",
            "server": "USA-W2",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "122.166667",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 4,
            "flightsamended": 3,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 6,
            "cruisealtsmodified": 1,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        },
        {
            "connection_id": 23766943,
            "start": "2010-05-04T22:49:12",
            "end": "2010-05-04T23:21:13",
            "server": "USA-W2",
            "vatsim_id": "1115151",
            "type": 2,
            "rating": 3,
            "callsign": "CYWG_GND",
            "times_held_callsign": 1,
            "minutes_on_callsign": "32.016667",
            "total_minutes_on_callsign": 740.25,
            "aircrafttracked": 0,
            "aircraftseen": 3,
            "flightsamended": 0,
            "handoffsinitiated": 0,
            "handoffsreceived": 0,
            "handoffsrefused": 0,
            "squawksassigned": 0,
            "cruisealtsmodified": 0,
            "tempaltsmodified": 0,
            "scratchpadmods": 0
        }
    ]
}

This endpoint will only return JSON.

Ryan Bentley
VATSIM Senior Developer
## [email protected]
Facebook Twitter Instagram
VATSIM Logo
Link to post
Share on other sites
  • 9 months later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...