API Developers
Getting Started
Let’s walk through API core concepts as we tackle some everyday use cases.
Overview
Most applications will use an existing wrapper library in the language of your choice; it’s important to familiarize yourself with the underlying API HTTP methods first.
There’s no easier way to kick the tires than through cURL. If you are using an alternative client, note that you are required to send a valid Authorization header in your request.
Also empty POST requests will return a description of the fields.
Authentication
Every request to the WPL REST API must supply a valid API token. You can get an API token in the WPL REST API Dashboard in wordpress backend.
Your application should send an Authorization header with every HTTP request to the API:
#!json
Authorization: Bearer {token}
Registration
The user registration API call can be used to create user accounts in the application. “Email”, “password”, “name”, “re-password” and “phone” fields are required.
- Method:
POST
URL
/wp-json/wpl_api/v1/register
Parameters Description
Field | Data Type | Required | Description |
---|---|---|---|
name | string | Y | The client\’s first name |
string | Y | The user\’s email address | |
phone | stirng | Y | Phone number |
password | stirng | Y | The client\’s password |
re-password | string | Y | The client\’s re-password |
- Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' \
-d '{
"name":"API",
"email":"[email protected]",
"password":"123321aA",
"re-password":"123321aA",
"phone":"+31232342342"
}' /wp-json/wpl_api/v1/register
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "User is created successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): name, email, password, re-password",
"data": {
"status": 400,
"params": [
"name",
"email",
"password",
"re-password"
]
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "The Email is already registered. Try a different Email address."
}
}
#!json
{
"success": false,
"data": {
"message": "Some or all of required filed entries are invalid."
}
}
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "password and the repeat are not matching."
}
}
Login
Registered users can login to establish their identity with the application using the API below. The login operation requires two parameters: Email and Password.
- Method:
POST
URL
/wp-json/wpl_api/v1/login
- POST Params
Field | Data Type | Required | Description |
---|---|---|---|
string | Y | The user\’s email address | |
password | stirng | Y | The client\’s password |
- Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' \
-d '{
"email":"[email protected]",
"password":"123321aA"
}' /wp-json/wpl_api/v1/login
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "Authentication passed successfully.",
"user_id": 11
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): email, password",
"data": {
"status": 400,
"params": [
"email",
"password"
]
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Authentication failed."
}
}
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
Reset Password
Registered users can reset their password via sms. To send SMS, we are using Twilio.
Reset Password process has two HTTP-based API Calls: First is reset password step and the second is change password step.
Required fields for Reset password step are “Email” and “Phone”, based on which the sms code is sent.
Note: To allow users change their password, you need to start from the Reset Password step. After receiving success message,
you should redirect the users to the change password step.
- Method:
POST
URL
/wp-json/wpl_api/v1/reset-password
POST Params
Required:
email
,phone
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"email":"[email protected]","phone":"+8273648723468"}' /wp-json/wpl_api/v1/reset-password
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "Sms Code sent successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): email, phone",
"data": {
"status": 400,
"params": [
"email",
"phone"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): email",
"data": {
"status": 400,
"params": {
"email": "Invalid email address."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Phone number is wrong."
}
}
Change the password
After password reset step, you should redirect client to “Change Password” step to finish the proccess.
Required fields for change password step are “email”, “code”, “password” and “re-password”.
- Method:
POST
URL
wp-json/wpl_api/v1/change-password
POST Params
Required:
email
,code
,password
,re-password
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"email":"[email protected]","code":"5684","password":"123321aA","re-password":"123321aA"}' /wp-json/wpl_api/v1/change-password
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "Password changed successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): code, email, password, re-password",
"data": {
"status": 400,
"params": [
"code",
"email",
"password",
"re-password"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): email",
"data": {
"status": 400,
"params": {
"email": "Invalid email address."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "Sms Code is incorrect."
}
}
#!json
{
"success": false,
"data": {
"message": "Some or all of required filed entries are invalid."
}
}
Listing types
Using this method (REST API CALL), you can get all the active listing types.
- Method:
GET
URL
/wp-json/wpl_api/v1/listing_types
Request:
#!shell
curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/listing_types
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"types": [
{
"id": "9",
"name": "For Sale"
},
{
"id": "10",
"name": "For Rent"
},
{
"id": "12",
"name": "Vacation Rental"
}
]
}
}
Error Response:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
Load Property Data
Using this method, you can recieve properties information; keep in mind the followings are mandatory options:
listing type, swlat, nelat, swlng, nelng.
Using these 5 parameters, you will be able to retrieve property data on the client side.
- Method:
POST
URL
/wp-json/wpl_api/v1/listings
POST Params
Required:
listing_type
,swlat
,swlng
,nelat
,nelng
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"listing_type":"9","swlat":"6.344604","swlng":"2.471924","nelat":"51.474654","nelng":"49.482639"}' /wp-json/wpl_api/v1/listings
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"properties": [
{
"id": "1499",
"bathrooms": "7",
"bedrooms": "5",
"price": "$6.5M",
"description": "FURNISHED ESTATE! Orlando",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1499/MLS1.jpg"
],
"longitude": "-81.514227",
"latitude": "28.445112"
}
]
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): listing_type, swlat, swlng, nelat, nelng",
"data": {
"status": 400,
"params": [
"listing_type",
"swlat",
"swlng",
"nelat",
"nelng"
]
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "No property could be found."
}
}
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
Detailed
Using this method, you will be able to get the listing details and agent information.
- Method:
POST
URL
/wp-json/wpl_api/v1/detailed
POST Params
Required:
listing_id
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"listing_id":"68"}' /wp-json/wpl_api/v1/detailed
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"id": "68",
"bathrooms": "2",
"bedrooms": "2",
"price": "$85.4K",
"description": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod...",
"images_count": "3",
"sqft": "269Sqft",
"lot_size": "3000Sqft",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/iStock-496916252.jpg",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl02.png",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl07.png"
],
"type": "Commercial For sale",
"location_text": "Laramie County, Wyoming",
"longitude": "-104.84546190000003",
"latitude": "41.4269559",
"agent_info": {
"agent": "Developer R",
"company": "Realtyna",
"tel": "+ (123) 4567234234",
"email": "[email protected]",
"image": "http://wpl28.realtyna.com/wp-content/uploads/WPL/users/42/profile.png"
}
}
}
Error Responses:
Code: 400
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): listing_id",
"data": {
"status": 400,
"params": {
"listing_id": "listing_id is not of type integer."
}
}
}
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): listing_id",
"data": {
"status": 400,
"params": [
"listing_id"
]
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "Listing with this ID: 13214234 could not be found."
}
}
Get The listing by MLS ID
Using this method, you will be able to get the listing details and agent information by mls id.
- Method:
GET
URL
/mls/(?P<id>[a-zA-Z0-9-]+)
Request:
#!shell
curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/mls/AC1234234B
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"id": "68",
"bathrooms": "2",
"bedrooms": "2",
"price": "$85.4K",
"description": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod...",
"images_count": "3",
"sqft": "269Sqft",
"lot_size": "3000Sqft",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/iStock-496916252.jpg",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl02.png",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl07.png"
],
"type": "Commercial For sale",
"location_text": "Laramie County, Wyoming",
"longitude": "-104.84546190000003",
"latitude": "41.4269559",
"agent_info": {
"agent": "Developer R",
"company": "Realtyna",
"tel": "+ (123) 4567234234",
"email": "[email protected]",
"image": "http://wpl28.realtyna.com/wp-content/uploads/WPL/users/42/profile.png"
}
}
}
Error Responses:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "Listing with this MLS ID: AC1234234A could not be found."
}
}
Filter
Using this method, you will receive information about the filtering fields, based on which you can perform the search commands.
- Method:
GET
URL
/wp-json/wpl_api/v1/filter
Request:
#!shell
curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/filter
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"items": [
{
"name": "Listing Type",
"type": "DropDown",
"key": "listing_type",
"results": [
{
"id": "-1",
"type": "Any"
},
{
"id": "9",
"type": "For Sale"
},
{
"id": "10",
"type": "For Rent"
},
{
"id": "12",
"type": "Vacation Rental"
}
]
},
{
"name": "Property Type",
"type": "DropDown",
"key": "property_type",
"results": [
{
"id": "-1",
"type": "Any"
},
{
"id": "6",
"type": "Apartment"
},
{
"id": "7",
"type": "Villa"
},
{
"id": "13",
"type": "Office"
},
{
"id": "14",
"type": "Land"
}
]
},
{
"name": "Bedrooms",
"type": "Tabs",
"key": "bedroom",
"results": [
{
"text": "ANY",
"min": "0",
"max": "10",
"selected": true
},
{
"text": "+1",
"min": "1",
"max": "10"
},
{
"text": "+2",
"min": "2",
"max": "10"
},
{
"text": "+3",
"min": "3",
"max": "10"
},
{
"text": "+4",
"min": "4",
"max": "10"
},
{
"text": "+5",
"min": "5",
"max": "10"
}
]
},
{
"name": "Bathrooms",
"type": "Tabs",
"key": "bathroom",
"results": [
{
"text": "ANY",
"min": "0",
"max": "10",
"selected": true
},
{
"text": "+1",
"min": "1",
"max": "10"
},
{
"text": "+2",
"min": "2",
"max": "10"
},
{
"text": "+3",
"min": "3",
"max": "10"
},
{
"text": "+4",
"min": "4",
"max": "10"
},
{
"text": "+5",
"min": "5",
"max": "10"
}
]
},
{
"name": "Price Range",
"type": "Input",
"key": "price",
"placeholders": [
"min",
"max"
]
},
{
"name": "Living Area (Sqft)",
"type": "Input",
"key": "sqft",
"placeholders": [
"min",
"max"
]
},
{
"name": "Keywords",
"type": "Input",
"key": "keywords",
"placeholders": [
""
]
},
{
"name": "Tags",
"type": "Checkbox",
"key": "tags",
"results": [
"Featured",
"Hot Offer",
"Open House",
"Foreclosure"
]
},
{
"name": "Neighborhood",
"type": "Checkbox",
"key": "neighborhoods",
"results": [
"Shopping Center",
"Hospital",
"Cinema",
"Park",
"Beach",
"Coffee Shop",
"Airport",
"Bus Station",
"Train Station",
"School",
"University",
"Police Station",
"Town Center",
"Exhibition",
"Tourist Site"
]
},
{
"name": "Appliances",
"type": "Checkbox",
"key": "appliances",
"results": [
"Heating System",
"Swimming Pool",
"Jacuzzi",
"Elevator",
"Cooling System",
"Garden",
"Balcony",
"Basement",
"Fence",
"View",
"Pet Policy",
"Kitchen",
"Steam",
"Gymnasium",
"Fireplace",
"Patio",
"Roof Deck",
"High Ceiling",
"Storage",
"Parking",
"Furnished",
"Security",
"Refrigerator",
"Stove",
"Microwave",
"Washing Machine",
"TV",
"CD Player",
"Internet",
"Hair Dryer",
"Cleaning Service",
"Oven",
"Dishwasher",
"Dishes",
"Satellite",
"Telephone",
"Towels",
"Hot Tub",
"Iron"
]
}
]
}
}
Error Responses:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
Search
Using this method, you can retrieve information about the properties; keep in mind the following options are mandatory:
swlat, nelat, swlng, nelng.
Using these 4 parameters, you will be able to load the property data. Also you can retrieve property data with different kind of keys (POST Params) like:
listing_type, property_type, minprice, maxprice, minsqft, maxsqft, minbedroom, maxbedroom, minbathroom, maxbathroom
- Method:
POST
URL
/wp-json/wpl_api/v1/search
POST Params
Required:
swlat
,swlng
,nelat
,nelng
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"swlat":"6.344604","swlng":"2.471924","nelat":"51.474654","nelng":"49.482639"}' /wp-json/wpl_api/v1/search
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"properties": [
{
"id": "1499",
"bathrooms": "7",
"bedrooms": "5",
"price": "$6.5M",
"description": "FURNISHED ESTATE! Orlando",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1499/MLS1.jpg"
],
"longitude": "-81.514227",
"latitude": "28.445112"
}
]
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): swlat, swlng, nelat, nelng",
"data": {
"status": 400,
"params": [
"swlat",
"swlng",
"nelat",
"nelng"
]
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "No property could be found."
}
}
Add Property to the Favorite List
Using this method, you can add the respective property to the favorites.
- Method:
POST
URL
/wp-json/wpl_api/v1/add-favorite
POST Params
Required:
user_id
,listing_id
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1","listing_id":"33"}' /wp-json/wpl_api/v1/add-favorite
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "Property added in favorite list successfully.",
"lastinsertId": "8"
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, listing_id",
"data": {
"status": 400,
"params": [
"user_id",
"listing_id"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "Sorry something went wrong!"
}
}
Remove Property from the Favorite List
Using this method, you can remove property from the favorite list.
- Method:
POST
URL
/wp-json/wpl_api/v1/remove-favorite
POST Params
Required:
user_id
,listing_id
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1","listing_id":"33"}' /wp-json/wpl_api/v1/remove-favorite
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "The listing is removed from Favorites successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, listing_id",
"data": {
"status": 400,
"params": [
"user_id",
"listing_id"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
Show Favorite List
Using this method, you can get the list of favorites by user id and page number. Also, you can get information about current page number, number of records in page,
and number of total pages.
- Method:
POST
URL
/wp-json/wpl_api/v1/favorite-list
POST Params
Required:
user_id
,page
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1","page":"1"}' /wp-json/wpl_api/v1/favorite-list
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"properties": [
{
"id": "45",
"bathrooms": "1",
"bedrooms": "2",
"price": "$506K",
"description": "",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/8.jpg"
],
"longitude": "-84.514227",
"latitude": "28.545112"
},
{
"id": "44",
"bathrooms": "2",
"bedrooms": "3",
"price": "$296K",
"description": "",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/44/2.jpg"
],
"longitude": "-81.514227",
"latitude": "28.445112"
}
],
"info": {
"current_page": 1,
"next_page": 2,
"previous_page": 1,
"total_page": 1
}
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, page",
"data": {
"status": 400,
"params": [
"user_id",
"page"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id, page",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer.",
"page": "page is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
#!json
{
"success": false,
"data": {
"message": "No property cound be found."
}
}
Add Save Search
Using this method, you can save the performed search parameters, like: map zoom level,search name,latitude and longitude.
- Method:
POST
URL
/wp-json/wpl_api/v1/add-search
POST Params
Required:
user_id
,zoom
,name
,latitude
,longitude
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1","zoom":"10","name":"TEST","latitude":"28.445112","longitude":"-81.514227"}' /wp-json/wpl_api/v1/add-search
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "The search is saved successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, zoom, name, latitude, longitude",
"data": {
"status": 400,
"params": [
"user_id",
"zoom",
"name",
"latitude",
"longitude"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
Remove Save Search
Using this method, you can remove save search information by user id and search name.
- Method:
POST
URL
/wp-json/wpl_api/v1/remove-save-search
POST Params
Required:
user_id
,name
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1","name":"TEST"}' /wp-json/wpl_api/v1/remove-save-search
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"message": "Saved search is removed successfully."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, name",
"data": {
"status": 400,
"params": [
"user_id",
"name"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
#!json
{
"success": false,
"data": {
"message": "Sorry something went wrong!"
}
}
Save Search List
Using this method, you can get the saved search data using user id.
- Method:
POST
URL
wp-json/wpl_api/v1/search-list
POST Params
Required:
user_id
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"user_id":"1"}' /wp-json/wpl_api/v1/search-list
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": [
{
"name": "California",
"zoom": "10",
"latitude": "23.76872341234",
"longitude": "-121.82736478"
},
{
"name": "TEST",
"zoom": "10",
"latitude": "23.76872341234",
"longitude": "-121.82736478"
}
]
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): user_id, name",
"data": {
"status": 400,
"params": [
"user_id"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): user_id",
"data": {
"status": 400,
"params": {
"user_id": "user_id is not of type integer."
}
}
}
- Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "User id does not exist."
}
}
#!json
{
"success": false,
"data": {
"message": "No Saved Search could be found."
}
}
Sort Options
Using this method, you can get all the active sort options, based on which you can perform the sort commands.
- Method:
GET
URL
wp-json/wpl_api/v1/sort-options
Request:
#!shell
curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/sort-options
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"options": [
{
"id": "2",
"name": "Price"
},
{
"id": "3",
"name": "Built up Area"
},
{
"id": "6",
"name": "Pictures"
},
{
"id": "8",
"name": "Property Type"
},
{
"id": "9",
"name": "Add date"
},
{
"id": "13",
"name": "Featured"
},
{
"id": "31",
"name": "Name"
},
{
"id": "32",
"name": "Country"
},
{
"id": "50",
"name": "Rank"
}
]
}
}
Error Responses:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "No Sort Options could be found."
}
}
Sorting Listings
Using this method, you can retrieve information about the properties by different sort option like: Price,Pictures,Add date,Built up Area and Country.
Also, you can get information about current page number, number of records in page, and number of total pages.
- Method:
GET
URL
wp-json/wpl_api/v1/sort-listings
POST Params
Required:
sort_id
,page
Request:
#!shell
curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"sort_id":"2","page":"1"}' /wp-json/wpl_api/v1/sort-listings
Success Response:
Code: 200
Content:
#!json
{
"success": true,
"data": {
"properties": [
{
"id": "2208",
"bathrooms": "0",
"bedrooms": "0",
"price": "$25M",
"description": "115.46 Acres (375 Lots) f",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/2208/iStock-500545264.jpg",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/2208/pl19.png"
],
"longitude": "-81.247143",
"latitude": "28.756668"
},
{
"id": "1443",
"bathrooms": "8",
"bedrooms": "6",
"price": "$19.9M",
"description": "Magnificently poised on 2",
"images": [
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/iStock-175448020.jpg",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/pl18.png",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/pl19.png",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/MLS5.jpg",
"http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/MLS4.jpg"
],
"longitude": "-82.679309",
"latitude": "27.427891"
}
],
"info": {
"current_page": 1,
"next_page": 2,
"previous_page": 1,
"total_page": 57
}
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): sort_id, page",
"data": {
"status": 400,
"params": [
"sort_id",
"page"
]
}
}
#!json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): sort_id, page",
"data": {
"status": 400,
"params": {
"sort_id": "sort_id is not of type integer.",
"page": "page is not of type integer."
}
}
}
Error Responses:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Signature verification failed. Please generate token first."
}
}
#!json
{
"success": false,
"data": {
"message": "No property could be found."
}
}
Inserting Listings
The insert command is used to add listings to your WPL database.
- Method:
POST
URL
wp-json/wpl_api/v1/add-listing
Body Parameters
Field | Data Type | Required | Description |
---|---|---|---|
listing_type | string | Y | Listing type; for example, for rent, for sale, vacation rental etc. |
property_type | string | Y | Property type; for example, residential, commercial, villa, apartment etc. |
price | number | Y | Listing price |
price_unit | string | Y | Price Currency name; for example, USD, CAD etc. |
price_period | string | N | If Listing type requires a recurring payment (like for rent, vacation rental, time sharing etc.), price period should be used to determine the interval; for example, it could be Per Month, Per Week, Per Year or Per Day. |
bedrooms | number | N | Number of bedrooms |
bathrooms | number | N | Number of full bathrooms |
half_bathrooms | number | N | Number of half bathrooms |
square_footage | number | N | Square Footage |
square_footage_unit | string | N | Square footage unit name; for example “Sqft”, “m2” etc. |
lot_area | number | N | Lot area |
lot_area_unit | string | N | Lot Area Unit name; for example “SqFt”, “m2” etc. |
year_built | number | N | Building year built |
address | array | Y | Location Address, consisting of Street Number, Street Name, ZipCode, City, State and Country |
image | array | Y | Image URL |
- Request body:
#!json
{
"listing_type" : "For Rent",
"property_type" : "Office",
"price" : 1500,
"price_unit" : "USD",
"price_period" : "Per Week",
"bedrooms" : 5,
"bathrooms" : 5,
"half_bathrooms" : 2,
"square_footage" : 123.34,
"square_footage_unit": "Sqft",
"lot_area":2342,
"lot_area_unit":"Sqft",
"year_built":1991,
"address": [
{
"county":"United States",
"state":"California",
"city":"Los Angeles",
"zipcode":"94025",
"street":"Hacker Way",
"street_number":"100110111"
}
],
"image": [
"Image source url.",
"Image source url."
]
}
- Request:
#!shell
curl -H 'Content-Type: application/json' --header \
"Authorization: Bearer Token" \
-X POST -d '{
"listing_type" : "For Rent",
"property_type" : "Office",
"price" : 1500,
"price_unit" : "USD",
"price_period" : "Per Week",
"bedrooms" : 10,
"bathrooms" : 5,
"half_bathrooms" : 2,
"square_footage" : 123.34,
"square_footage_unit": "Sqft",
"lot_area":2342,
"lot_area_unit":"Sqft",
"year_built":1991,
"address": [
{
"county":"United States",
"state":"California",
"city":"Los Angeles",
"zipcode":"94025",
"street":"Hacker Way",
"street_number":"100110111"
}
],
"image": [
"Image source url.",
"Image source url."
]
}' wp-json/wpl_api/v1/add-listing
Success Response:
Code: 201
Content:
#!json
{
"success": true,
"data": {
"message": "Property successfully added."
}
}
Error Responses:
Code: 400
Content:
#!json
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): listing_type,property_type,price,price_unit,address,image",
"data": {
"status": 400,
"params": [
"listing_type",
"property_type",
"price",
"price_unit",
"address",
"image"
]
}
}
Error Responses:
Code: 200
Content:
#!json
{
"success": false,
"data": {
"message": "Insert operation has failed."
}
}
#!json
{
"success": false,
"data": {
"message": "Unknown Listing Type."
}
}
#!json
{
"success": false,
"data": {
"message": "Unknown Property Type."
}
}
#!json
{
"success": false,
"data": {
"message": "Array of Address is not valid."
}
}
#!json
{
"success": false,
"data": {
"message": "Price Period is not valid."
}
}
#!json
{
"success": false,
"data": {
"message": "Unknown unit type of price."
}
}