We have provided the following code samples to assist you with developing your application to add & remove listings.
This request demonstrates all of our available data elements for adding a listing. For further information, review our documentation.
<xml> <key>Your api key</key> <properties> <property> <action>List</action> <id>1000</id> <updated>2022-05-18 21:37:53</updated> <expire>2022-08-18</expire> <type>House</type> <street>123 Birch Lane</street> <city>Raleigh</city> <state>NC</state> <zip>27615</zip> <latitude>35.875897</latitude> <longitude>-78.725046</longitude> <contact_name>Your Name</contact_name> <contact_email>your.name@company.com</contact_email> <contact_phone>(919) 555-1212</contact_phone> <units> <unit> <name>4 Bedroom</name> <beds>4</beds> <baths>2.5</baths> <sqft>2250</sqft> <rent_min>1250</rent_min> <rent_max>1500</rent_max> <term>Month</term> </unit> </units> <amenities> <amenity>ac</amenity> <amenity>bl</amenity> <amenity>cb</amenity> <amenity>cf</amenity> </amenities> <features> <feature>bp</feature> <feature>bo</feature> <feature>ch</feature> <feature>ca</feature> </features> <photos> <photo> <description>Front of home</description> <url>https://www.rentalsource.com/images/listings/1000-1.jpg</url> </photo> <photo> <description>Kitchen</description> <url>https://www.rentalsource.com/images/listings/1000-2.jpg</url> </photo> <photo> <description>Living Room</description> <url>https://www.rentalsource.com/images/listings/1000-3.jpg</url> </photo> </photos> <description>Insert description of rental property</description> <terms>Insert rental property lease terms</terms> <website>https://www.rentalsource.com/1000</website> </property> </properties> </xml>
<xml> <response> <properties> <property> <id>1000</id> <action>List</action> <result>Success</result> <listing>https://www.rentalsource.com/xxxxxx</listing> </property> </properties> </response> </xml>
<xml> <response> <properties> <property> <id>1000</id> <action>List</action> <warnings> <warning>sqft value wasn't specified - we have defaulted to n/a</warning> <warning>rent_term doesn't reference a valid duration - we have defaulted to a monthly rental term</warning> <warning>photo #1 url doesn't reference a valid photo</warning> </warnings> <result>Success</result> <listing>https://www.rentalsource.com/xxxxxx</listing> </property> </properties> </response> </xml>
<xml> <response> <properties> <property> <id>1000</id> <action>List</action> <errors> <error>type specified must be a valid category</error> <error>valid zip must be specified for each property listing</error> </errors> <result>Failed</result> </property> </properties> </response> </xml>
This request demonstrates how to remove listings.
<xml> <key>Your api key</key> <properties> <property> <action>Remove</action> <id>1000</id> </property> </properties> </xml>
<xml> <response> <properties> <property> <id>1000</id> <action>Remove</action> <result>Success</result> </property> </properties> </response> </xml>
<xml> <response> <properties> <property> <id>1000</id> <action>Remove</action> <errors> <error>id specified doesn't reference a valid property listing</error> </errors> <result>Failed</result> </property> </properties> </response> </xml>
This simulates the adding of a listing using PHP cURL and printing the response.
<?php $feed = "<xml> <key>Your api key</key> <properties> <property> <action>List</action> <id>1000</id> <type>House</type> <street>123 Birch Lane</street> <zip>27615</zip> <contact_name>Your Name</contact_name> <contact_email>your.name@company.com</contact_email> <photos> <photo> <url>https://www.company.com/images/listings/1000-1.jpg</url> </photo> </photos> <description>Insert description of rental property</description> </property> </properties> </xml>"; $session = curl_init(); curl_setopt($session, CURLOPT_URL, "https://www.rentalsource.com/api/"); curl_setopt($session, CURLOPT_POST, 1); curl_setopt($session, CURLOPT_POSTFIELDS, $feed); curl_setopt($session, CURLOPT_HEADER, true); curl_setopt($session, CURLOPT_HTTPHEADER, array("Accept: text/xml", "Content-Type: text/xml")); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($session); curl_close($session); echo $response; ?>