At https://dev-7.flyerlink.com/api_tester.php we provide a sandbox for API requests, which documents the API requests, along with convenient entry forms where you can specify values for parameters..
Use standard HTTP requests to communicate with the API.
GET requests are used to read data from TemplateCloud using the API;
PUT and POST requests try to write information to TemplateCloud using the API.
The following example is a request to the API’s sandbox handler, which returns a list of tag types:
GET https://dev-7.flyerlink.com/api_tester.php/tag_types/?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
You have the option of specifying the response format using the format parameter. Allowed values are json or xml, the default being xml.
When sending a POST or PUT request, we expect them as HTTP form fields
You can push them through as an array
Here's an example of a POST customer request
<?php $postFields = [ "id" => "HOTEST", "name" => "Jean TEST", "username" => "API example", "password" => "example1234", "email" => "bbb@test.com", "telephone" => "01470054111", "mobile" => "0674584511", "address1" => "", "address2" => "Your Address", "address3" => "", "address4" => "Manchester", "address5" => "", "postcode" => "M17 1AA", "countrycode" => "GB", "workgroup" => "W11", "category" => "816", "payment_terms_code" => "CASH", "payment_terms_description" => "Cash" ]; $s = curl_init(); $username = 'xxx'; $password = 'xxx'; curl_setopt($s, CURLOPT_URL, 'http://dev-7.flyerlink.com/api.php/customers'); curl_setopt($s, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($s, CURLOPT_RETURNTRANSFER, true); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $postFields); $result = curl_exec($s); $resstatus = curl_getinfo($s, CURLINFO_HTTP_CODE); curl_close($s); var_dump($result); var_dump($resstatus);
You’ll need your own user_key (see Getting your App Approved).
{ "status": "error", "message": "Template not found" }
Where one record is returned, it is presented as a lone object, e.g.
GET https://dev-7.flyerlink.com/api_tester.php/tag_types/1?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
{ "tag_type": { "id": "1", "name": "Industry Types" } }
Where more than one record is returned, the top-level object is an array (having a plural name tag_types), containing child tag type objects.
e.g. here are the requests and responses for tag types:
GET https://dev-7.flyerlink.com/api_tester.php/tag_types/?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
{
"tag_types": [
{
"id": "1",
"name": "Industry Types"
},
{
"id": "2",
"name": "Client"
},
etc...
]
}
The XML version is below. Note that the above JSON does not encapsulate the array's items as named objects, but the XML necessarily does:
GET https://dev-7.flyerlink.com/api_tester.php/tag_types/?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=xml
<response status="ok">
<tag_types>
<tag_type>
<id>1</id>
<name>Industry Types</name>
</tag_type>
<tag_type>
<id>2</id>
<name>Client</name>
</tag_type>
etc...
</tag_types>
</response>
See also
|
|||
Jump to contents page of
|