This reference documents version 2 of the Placester RESTful API.

The code in this document requires an API key which you can obtain from the Placester plugin. Each call to the API returns a maximum of 50 listings. If you need more listings, refer to the offset argument below.

Basic Use

In order to add any photos to a listing, you must first upload them as a temp image using this call. You will then be able to add the temp file name to the listing which will make the image permanent.

  POST - http://api.placester.com/api/v2/listings/media/temp/image[.format]?api_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[.format] can be .xml or .json depending on the format you want the API to output.

cURL

curl -F file=@test.png -F "api_key=xxxxxxxxxxxxxx" http://api.placester.com/api/v2/listings/media/temp/image

PHP

$url = 'http://api.placester.com/api/v2/listings/media/temp/image?api_key=' . $my_api_key_here;
$imagefile = "test.png";

$curlcall = curl_init();
curl_setopt($curlcall, CURLOPT_URL, $url);
curl_setopt($curlcall, CURLOPT_POST, 1);
curl_setopt($curlcall, CURLOPT_POSTFIELDS,array('file'=>new CURLFile($imagefile)));

$curlout = curl_exec($curlcall);

Arguments

Arguments are specified on the URL usually after the API key and are separated by an &. You can use the following patterns for different types of arguments:

Format URL Argument
String, Integer, or Float key=StringValue
Array key[]=StringValue1&key[]=StringValue2&key[]=StringValue3…
Hash metadata[key]=2&metadata[key]=4

 

Argument Description Example
file The file you want to upload, Required

 

Returns

Key Description
filename The temporary filename, you will need this to pass to listing create/update calls to make a temporary image permanent
orig_name The original name of the file uploaded
url Temporary URL to access the file

 

Sample Output

<?xml version="1.0" ?>
<media>
    <filename>cizg8fjs90ynnr65od3mzcphsauyr90ihcc4eq4f.png</filename>
    <orig-name>ListingWithSlideShow.png</orig-name>
    <url>

https://s3.amazonaws.com/uploads.cdn.placester.net/temp/51ae37f71cdabc7270000001/cizg8fjs90ynnr65od3mzcphsauyr90ihcc4eq4f.png

    </url>
</media>