Difference between revisions of "API: Getting started"
Olwin Froon (talk | contribs) m (→API root) |
Olwin Froon (talk | contribs) (→API root) |
||
Line 18: | Line 18: | ||
You access the API via a directory tree on the SWC website. Root directory is | You access the API via a directory tree on the SWC website. Root directory is | ||
− | http://www.swcombine.com:8081/ws/v1.0/ | + | http://www.swcombine.com:8081/ws/v1.0/ |
Revision as of 12:30, 13 February 2015
API?
API means Application Programming Interface, but you probably knew that already.
The Combine API allows direct access to the Combine's database from your application program. Not all of it, though, and not right away, it's not that simple.
There are public resources and there are private resources.
"Private" means, you'd access via a specific character's scope. That requires proper authentication, of course, and it's not exactly trivial.
So we'll focus on a few public resources for now, not only to get into the right mood but also because there's quite some nifty stuff available.
API root
You access the API via a directory tree on the SWC website. Root directory is
http://www.swcombine.com:8081/ws/v1.0/
Yes, give it a try. It won't explode in your face ... I hope. Not often, anyway.
The XML response to this URI is the API's index resource, which also poses as source code for the documentation, which is currently unavailable on the main server.
(If you insist on seeing it, sign up on [the dev server] and [check this])
Lots and lots of XML stuff. It does come in handy once in a while, but for now you can safely ignore it.
A first sample
Let's dig a wee bit deeper and try one of the public resources. No, not "hello world", but:
http://www.swcombine.com:8081/ws/v1.0/api/time/real/
Response:
<?xml version="1.0" encoding="UTF-8"?> <timereal xmlns="http://www.swcombine.com/ws/timereal-ns/" version="1.0" timestamp-swc="[swcTime]"> <timestamp-unix>[realTime]</timestamp-unix> </timereal>
There we go.
All API responses follow the same pattern: There is a proper XML header and a root element with a unique name, suitable to identify the resource you're looking at, and a few standard attributes like
- the XML name space xmlns
- the API version version
and
- the SWC timestamp timestamp-swc
, when this response was created.
Note that timestamp-swc
is SWC's variant of unix time.
You will discover, that you can convert an SWC timestamp into a regular unix timestamp by adding a constant value of 912668400.
So, whenever you encounter a timestamp-swc
, you'll know what to do.