{"id":33,"date":"2014-04-18T15:23:46","date_gmt":"2014-04-18T15:23:46","guid":{"rendered":"http:\/\/www.autorouter.eu\/wiki\/?page_id=33"},"modified":"2023-05-18T08:40:01","modified_gmt":"2023-05-18T08:40:01","slug":"api","status":"publish","type":"page","link":"https:\/\/www.autorouter.aero\/wiki\/api\/","title":{"rendered":"Application Programming Interface"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>The autorouter web interface is built on top of a RESTful API exporting the complete autorouter functionality. This application programming interface (API) is also available to 3rd party applications.<\/p>\n<p>Clients issue HTTPS requests to the autorouter server, making use of the HTTP request types GET, POST, PUT and DELETE with request specific URLs and passing input data as either HTTP parameters or JSON formatted messages in the request body. Responses can be HTTP status codes or JSON messages in the body.<\/p>\n<h1>Structure<\/h1>\n<p>The API is structured around the following principal entities:<\/p>\n<ul>\n<li><a title=\"User\" href=\"\/wiki\/api\/user\/\">Users<\/a><\/li>\n<li><a title=\"Aircraft\" href=\"\/wiki\/api\/aircraft\/\">Aircraft<\/a><\/li>\n<li><a title=\"Routes\" href=\"\/wiki\/api\/routes\/\">Routes<\/a><\/li>\n<li><a title=\"Flightplan\" href=\"\/wiki\/api\/flightplan\/\">Flightplans<\/a><\/li>\n<li><a title=\"Navdata\" href=\"\/wiki\/api\/navdata\">Navdata<\/a><\/li>\n<li><a href=\"\/wiki\/api\/weather\">Weather<\/a><\/li>\n<li><a href=\"\/wiki\/api\/briefing\/\">Briefing<\/a><\/li>\n<li><a href=\"\/wiki\/api\/documents\">Documents<\/a><\/li>\n<li><a href=\"\/wiki\/api\/notams\">NOTAMs<\/a><\/li>\n<\/ul>\n<p>Typically, operations are performed on these entities where GET retrieves information, POST creates an entity or performs an operation, PUT updates\/replaces an entity and DELETE removes an entity.<\/p>\n<h1>Authentication<\/h1>\n<p>The web frontend to autorouter contains an email \/ password authentication (alternatively an external OAuth 2.0 authentication from 3rd party ID providers) and uses session cookies to authenticate individual API calls during the lifetime of the session. This is typically not practical for API users which is why an additional method is offered.<\/p>\n<p>You will find more information on how to perform the authentication here:\u00a0<a title=\"Authentication\" href=\"\/wiki\/api\/authentication\/\">Authentication via OAuth 2.0<\/a><\/p>\n<h1>API invocation<\/h1>\n<p>The RESTful API is located at<\/p>\n<pre>https:\/\/api.autorouter.aero\/v1.0\/&lt;group&gt;\/&lt;request&gt;<\/pre>\n<p>for example a HTTP POST to<\/p>\n<pre>https:\/\/api.autorouter.aero\/v1.0\/router<\/pre>\n<p>to create a new route.<\/p>\n<p>API requests return a HTTP status\u00a0code. The following status\u00a0codes are used:<\/p>\n<ul>\n<li><strong>200<\/strong><br \/>\nRequest completed successfully.<\/li>\n<li><strong>400<\/strong><br \/>\nInvalid request data. Some of the data passed to the call is not valid.<\/li>\n<li><strong>401<\/strong><br \/>\nNot authorized. You did either supplier no credentials, expired credentials or invalid credentials. You can try the request again with correct credentials.<\/li>\n<li><strong>403<\/strong><br \/>\nAccess denied. You do not have permission to access the resource or perform the operation. Repeating the request will not help.<\/li>\n<li><strong>404<\/strong><br \/>\nObject not found. Most likely an object referenced through the request URL was not found or could not be accessed due to insufficient privileges (the API will not tell you that for security reasons).<\/li>\n<li><strong>500<\/strong><br \/>\nInternal error processing the request. This shouldn&#8217;t really happen so we&#8217;re grateful for reports and scenarios where this happens.<\/li>\n<li><strong>503<\/strong><br \/>\nThe server cannot handle the request at the given time due to capacity issues. The request should be attempted again at a later time. If the issue is frequent or prevails over a longer period of time, a support ticket should be opened.<\/li>\n<\/ul>\n<p>In most cases you will get a more descriptive error message in the body of the response.<\/p>\n<h1>Versioning<\/h1>\n<p>The API is guaranteed to remain interface compatible in line with the <a href=\"http:\/\/semver.org\/spec\/v2.0.0.html\">Semantic Versioning<\/a>\u00a0specification\u00a0in which a version is comprised of 3 numbers in the format MAJOR.MINOR.PATCH where an increment of each component has the following meaning:<\/p>\n<ul>\n<li><strong>MAJOR<\/strong><br \/>\nWhen incompatible API changes are made.<\/li>\n<li><strong>MINOR<\/strong><br \/>\nWhen functionality is added in a backwards-compatible manner.<\/li>\n<li><strong>PATCH<\/strong><br \/>\nWhen backwards-compatible bug fixes are applied.<\/li>\n<\/ul>\n<p>Some APIs are documented as &#8220;<strong>unstable<\/strong>&#8220;. For these APIs, the above interface stability guarantee does not apply. They may see incompatible changes between minor version updates. If you rely on an unstable API, please contact us to discuss your needs and how we can promote it to stable API.<\/p>\n<p>To query the current version of the API, perform the following request<\/p>\n<pre>HTTP GET https:\/\/api.autorouter.aero\/v1.0\/system\/version<\/pre>\n<p>This returns a JSON structure containing the major and minor version number.<\/p>\n<pre>{\n   \"major\": 1,\n   \"minor\": <span>0<\/span>,\n   \"patch\": 19,\n   \/* whether this is a production system (false for test\/sandbox system) *\/\n   \"production\": true,\n   \/* the minimum version of the API supported by the server *\/\n   \"minVersion\":\n   {\n      \"major\": 1,\n      \"minor\": 0\n   },\n   \/* whether the system considers the call to be authenticated *\/\n   \"auth\": false\n}<\/pre>\n<p>All invocations of the API contain the major and minor number as part of the URL (https:\/\/api.autorouter.aero\/v1.0). This allows the platform to introduce changes to the API but maintain backwards compatibility by continuing to provide the previous version of the API which requires knowing which version of the API the client expects. If you omit the version number, the server will assume the latest version of the API. It is beneficial to check back regularly for the latest API revision and adapt your application to make use of it. This will both give you access to added capabilities and keep you close to development so that when a major update happens and a previous version is finally retired from service, you most likely won&#8217;t have to make any changes or only small changes to your application.\u00a0The API changes for each version number are documented in the <a title=\"Changelog\" href=\"\/wiki\/api\/changelog\/\">API changelog<\/a>.<\/p>\n<h1>Messages<\/h1>\n<p>Certain events trigger messages that clients can subscribe to using the <a href=\"\/wiki\/api\/message-queue\/\">message queue facility<\/a>.<\/p>\n<h1>Samples<\/h1>\n<ul>\n<li><a title=\"PHP API sample with cURL\" href=\"\/wiki\/php-api-sample-with-curl\/\">Simple PHP sample with OAuth 2.0 using cURL<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The autorouter web interface is built on top of a RESTful API exporting the complete autorouter functionality. This application programming interface (API) is also available to 3rd party applications. Clients issue HTTPS requests to the autorouter server, making use of the HTTP request types GET, POST, PUT and DELETE with request specific URLs and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-33","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/pages\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":33,"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/pages\/33\/revisions"}],"predecessor-version":[{"id":1016,"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/pages\/33\/revisions\/1016"}],"wp:attachment":[{"href":"https:\/\/www.autorouter.aero\/wiki\/wp-json\/wp\/v2\/media?parent=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}