Get started with APFy.me
How APFy.me works
APFy.me works as a reverse proxy. When a client application requests data from APFy.me we will relay the request to the source server and transform the response to a formatted response in XML or JSON.
Headers and request parameters that you send in the API request will be forwarded to the source web page (except some special ones). We will also append some proxy headers to identify the caller (you) as well as the proxy. The parameters defined in the API definition are the ones that will be validated but you can send any parameter you like in addition to the defined ones.
How to consume an API
To get started you need to create a user to get an API-Key. See below for special header parameters that can be appended in each request.
|x-apfy-accept||Default response is XML, if you want JSON response instead just pass this parameter and assign it the value: application/json||False|
|x-apfy-param-[...]||All parameters starting with this syntax will be appended as parameters to the XSLT if it accepts them. See the definition of each API which parameters that can be used.||False|
|accept-encoding||APFy.me supports GZip and Deflate compression and we encourage you to use them if possible to reduce the network traffic.||False|
|x-apfy-debug||To debug an api-call, just set this header to true to get an extended response back with more information about the request.||False|
When the response comes back to the client we will always append a x-apfy-status-header that contains an APFy.me status code
NB! All responses will be in Utf-8 encoding no matter what the encoding of the source web page is.
Please do not hammer since it migth cause APFy.me to be banned from accessing the source web page. When looping requests ALWAYS let your program sleep for at least one second between calls (even more would be nice).
How to create an API
To get started you need to create a user and select an Alias that will also be used as a namespace where all your methods will be added.
APFy.me is based on .net so when you need information about dialect specific things (like Regular expressions) you know what to search for.
The easiest way to get started is to use the Playground to test a request and laborate with XSLT and XSD. When you're satisfied you can save your API-method to make it accessible for anyone to use.
If you want to let the consumers to control the output from the XSLT you can let them send parameters to the template by appending headers in the form x-apfy-param-[yourParamName].
When creating an API method, please describe the method and all the parameters to that it's easy to understand the purpose of the method and how to call it. It's also good practice to always supply an example response so that consumers knows what to expect as response.