Inara API is a way how to update, send or get stuff from/to Inara. Its goal is to provide an easy method how to update your stuff here on Inara or get some data, not to provide a general 'data relay' for all Elite stuff. It was created to be as easy and understandable as possible, but it requires some development skills. If you don't know what it is about, this page of API details is probably not for you and just use any of the released apps instead, listed on the API main page. In other words - the following lines are for developers only. ;)
Inara API and its events are not intended to be one-to-one copy of the journals generated by the game or anything else, so in some cases you will need to properly handle (multiple) journal events before sending it to Inara API. It was made that way to ensure future enhanceability and independence on the journal or Frontier's companion API (cAPI) changes and improvements.
Before you provide your app to users, please be sure everything is working correctly, without any errors and you are not sending any game beta data, it is your own responsibility. Feel free to create an additional account on Inara for development and testing purposes. But, of course, if you find any bugs in the Inara API, please let me know. Also, please, let me know your app name/identifier you will be using, as it needs to be white-listed first. It is not meant to exclude anyone from using Inara API, rather a way how to identify possible problems and also to provide users a list of applications they may use.
Please send me the following:
Although I do not want to make things too restrictive, there are some recommendations/rules. I really do not want to have my server hamsters hammered down to death by tons of requests on materials pickups and so on. ;)
The main simple rule is just: "be polite!". If you do not need to have an immediate response or you are sending a stuff that doesn't need to be updated immediately, use the event batching and limit number of requests whenever possible.
Inara API is using JSON for its inputs and outputs with a single endpoint. You will simply POST a data in the predetermined structure to the designated URL and it's done.
Input JSON structure consists from header block with Inara API key identifying the user or application, your app details and events block, where are all the events and their properties/data. There is used an event batching, so you can send multiple events at once for the same user and it is recommended to do so. You will find more detailed description and examples in the API documentation.Simple steps are following:
... $apitestdata = array(); // your data should be there $jsondata = json_encode($apitestdata); $url = "https://inara.cz/inapi/v1/"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsondata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); // process the result as you wish ...