1. Home
  2. Docs
  3. Developer Guide
  4. REST API

REST API

Retrieving Properties

You can access the properties via the WordPress REST API by visiting the below URL:

https://{your-site.com}/wp-json/wp/v2/property

You can filter the properties returned by passing in the same parameters as used on a standard property search on the website. For example:

https://{your-site.com}/wp-json/wp/v2/property?department=residential-lettings
https://{your-site.com}/wp-json/wp/v2/property?department=residential-lettings&minimum_bedrooms=2

Don't forget that results returned will be paginated by default. More about pagination here in the WP REST API docs.

Creating and Updating Properties

You can also create and update properties using Property Hive and the WordPress REST API.

The first step will be to read about authentication to enable you the access to make requests.

Once authentication is sorted, you can publish and update properties direct to Property Hive from a third party application.

A simple example of a POST request to update an existing property would look something like so:

POST https://{your-site.com}/wp-json/wp/v2/property/243328 HTTP/1.1
Content-Type: application/json
Authorization: Basic {application-password}

{"title":"High Street, Birmingham","status":"publish","on_market":"yes","department":"residential-sales","address_country":"GB","price":123000,"features":["poolside","fireplace"],"virtual_tours":[{"url":"https:\/\/youtube.com","label":"VT1"},{"url":"https:\/\/vimeo.com","label":"VT2"}],"images":[{"url":"https:\/\/imageurl.com\/image1.jpg"},{"url":"https:\/\/imageurl.com\/image2.jpg"}]}

Articles

Was this article helpful to you? No Yes 1

How can we help?