Structure & Standards
We tried to develop the API to be as consistent as possible. As
such, we've implemented a few standards requests and responses must
adhere to. The sections listed below can be used as a general
guideline when interacting with the Snaggr API service.
Url Structure
Access to the API is done by pointing all requests to a standardized URL. The URL itself varies from service to service, but is structured according to the following standard:
http://rest.snag.gr/{GROUP}/{SERVICE_TYPE}.{SERVICE_NAME}.{SERVICE_FORMAT}
- {SERVICE_GROUP} represents the category of
services you are attempting to access. At the moment, the only
supported group is
images, but there are plans to eventually addvideosto the search service. - {SERVICE_TYPE} is the kind of action you wish
to perform with a service. There are currently 3 classes of
actions:
get,postanddelete - {SERVICE_NAME} is the actual name of the
service, such as
providersorcache. - {SERVICE_FORMAT} determines the format in
which you want the service response to be presented. There are
currently 3 supported formats:
json,phpandxml
Following this URL schema, a normal API call may point to something like the following example:
http://rest.snag.gr/images/post.search.xml
Service Structure
As outlined in the previous section, an actual call to a service
includes specifying the type, name and
format. Naturally, all services will have some kind of
distinct name, but not all services support every
combination of type and format. These
details can be found by browsing the actual service list
documenation.
Some examples of a service's structure are:
Required Parameters
The set of required parameters varies from service to service, but at the very least, it is expected to provide us with your API key.
Date Formats
All dates and times returned by the API conform to the following standard:
YYYY-MM-DD HH:MM:SS
Some examples include:
- 2009-11-25 13:10:57
- 2009-12-10 01:43:58
- 2009-12-10 01:36:36
Service Types
We currently support three types of service calls:
getpostdelete
Service Response Formats
We currently support three types of service response formats:
jsonphpxml
You can view sample responses by reading the API Response Samples page.
HTTP Request Types
All interaction with this API is done with either HTTP
POST or GET requests.