Accessing the iPhone companion app api using curl

Authors

Status
Active
With an API
Compatible with release
Sources available
Supported languages
English en
Platform
GameApplication Linux GameApplication Mac GameApplication Windows
Elite:Dangerous Application

Share

A quick-start guide for accessing the iPhone companion app api using the command line tool curl.

I have been playing around with the API from the command line so thought I'd put down my notes as a quick-start guide to accessing the API.

The first step that you will need to carry out is to login. To do so you can use the following command:
 

Code:

EMAIL=YOUR_LOGIN_EMAIL_HERE

PASSWORD=YOUR_PASSWORD_HERE

USER_AGENT="Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257" curl -c cookies.txt -H "User-Agent: ${USER_AGENT}" -d email=${EMAIL} -d password="${PASSWORD}" https://companion.orerve.net/user/login

 

If the email and password are correct you should receive an authentication token to the email account specified in ${EMAIL}, the same as you would when you first log in to a machine. Note that if you have any special characters in your password (e.g. &) then these will need to be escaped using standard URL encoding.

Once you have this code you can send the confirmation request:
 

Code:

CODE=YOUR_CONFIRMATION_CODE_HERE

curl -b cookies.txt -c cookies.txt -H "User-Agent: ${USER_AGENT}" -d code=${CODE} https://companion.orerve.net/user/confirm

 

Again assuming that the code is correct you will now be set up to request data using the API. For example to obtain your profile:
 

Code:

curl -b cookies.txt -c cookies.txt -H "User-Agent: ${USER_AGENT}" https://companion.orerve.net/profile | sed -e 's/True/true/g' -e 's/False/false/g' -e s/\'/\"/g

 

The munging of the returned data via sed is to turn it in to standard JSON; feel free to skip this bit if you have a more forgiving parser.

 

Admin comment: The example shown is for Unix/Linux and runs in a shell. It can also run unchanged on windows when using a tool like cygwin or a similar tools which allows you to run linux commands. Mac OS which is Unix operating system with a GUI probably will also run the example - if curl is default installed on it. Curl however is also ported to Windows. Aside from curl there is from the same makers also libcurl - the multiprotocol file transfer library. Basically the same as curl but usable as a library which can be used in programs - without the need to call the external curl program. You use can libcurl with the provided C API or one of the over 40 available bindings.


Links

History

  • Jan 24, 2016 (wolverine2710) Added libcurl link in the full description. Added in the full description info about language bindings.
  • Jan 24, 2016 (wolverine2710) First revision

API

Retrieves data from the iPhone api to be used in other programs.

Tools using the API