Structure of API Calls
Calls to actions performed by the Defensio web service adhere to the following structure:
http://api.defensio.com/{service-type}/{api-version}/{action}/{api-key}.{format}
where:
- {service-type}
-
denotes the type of service being requested (currently supported are: "app" (i.e. use of Defensio within an application) and "blog" (i.e. use of Defensio to support a blogging platform); these names are used interchangeably in the examples below)
- {api-version}
-
denotes the version of the API being called (currently "1.2")
- {action}
-
denotes the desired action (see list supported below)
- {api-key}
-
is a valid key unique to the calling user (e.g. an alpha-numeric string)
- {format}
-
denotes the desired response format (currently supported are "xml" and "yaml")
All calls to the Defensio web service are POST requests. Further note that when a POST parameter is a URL, it should be submitted as one that is valid and fully-formed (e.g. http://my.blog.com).
Structure of Action Responses
By providing either the .xml or .yaml extension to each action call, the Defensio API allows developers the ability to choose their favorite (or most convenient) structured response format for easy, and consistent parsing.
Why do we provide for multiple formats? Simply because we believe that choice is a good thing. In each case, the response contents are equivalent - only the way they are formatted changes. Their structure consists of a depth-2 tree structure, with 'defensio-result' as the root node and a list of key-value pairs as its children nodes.
All action responses include a "status" node, whose value ("success" or "fail") denotes whether or not the call could be successfully processed. The "message" node of each response is provided for informational purposes only; it should not be relied upon programatically as it is not guaranteed to provide a constant string. The API version is always returned for convenience.
The following example responses demonstrate the minimal response set both in XML and YAML formats:
| Sample XML Response | Sample YAML Response |
|---|---|
|
<?xml version="1.0" encoding="UTF-8"?>
<defensio-result> <message>A status message</message> <status>success</status> <api-version>1.2</api-version> </defensio-result> |
defensio-result:
message: "A status message" status: success api-version: "1.2" |
- PDF Version
-
Download a PDF version of our API documentation; sometimes paper is just more convenient!
- Developer Guidelines
-
This document of best practices will help guide developers to extracting maximum benefit from the Defensio API. It is included in the PDF API document .