-
Notifications
You must be signed in to change notification settings - Fork 30
Command Line Tool
The EVELink library comes with a command line tool which can be used to make API calls (either for testing purposes or for piping data to other tools). It lives at bin/evelink
.
You can make an API call via the EVELink wrappers by specifying the path to the function you want the tool to call. For instance, to get the character ID for a given character name:
$ bin/evelink eve.EVE.character_id_from_name Aaeriele
APIResult(result=90083631, timestamp=1424651867, expires=1427071067)
To make calls that require an API key (e.g. char
or corp
calls), you can specify one by passing the --key
argument with the form --key=KEYID:VCODE
:
$ bin/evelink --key=12345678:XXXXXXXXXXXXXXXXX char.Char.wallet_balance 90083631
Note that by default the output is a repr()
of the same result you'd normally get, an APIResult
object. This may not be what you want if you're passing the data on to another tool; as an alternative option you can ask the tool to give JSON output instead via the --json
flag:
$ bin/evelink --json eve.EVE.character_id_from_name Aaeriele
[
90083631,
1424651867,
1427071067
]
You can also use the tool to make queries against the XML API directly, if you want to look at the raw XML returned or want to fetch an endpoint for which EVELink doesn't have a wrapper:
$ bin/evelink Eve/CharacterId names=Aaeriele
<result>
<rowset columns="name,characterID" key="characterID" name="characters">
<row characterID="90083631" name="Aaeriele" />
</rowset>
</result>
If you want to talk to a different API endpoint than the default (e.g. if you want to use the API for Singularity), you can specify a different endpoint base:
$ bin/evelink --base=api.testeveonline.com ...
Some of the options for the tool are ones you'd wind up specifying repeatedly (e.g. API key, endpoint). To avoid this becoming too onerous, the tool supports reading configuration from a file rather than having it specified on the command line.
By default, this tool attempts to read from ~/.evelinkrc for configuration data. Any path specified via the -r flag will be read in addition to this. Options set in the additional config will override values in the default config. If this file exists and has the proper INI format, the following items can be loaded from it (every section is optional):
[cache]
path=<path to file in which to store cached api results>
[apikey]
id=<id of API key to use>
vcode=<verification code of API key to use>
[char]
id=<id of character to use for Char API calls>
[api]
base=<base url of the api endpoint, e.g. api.eveonline.com>