302.525.8222Call today for a FREE Consultation

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:

  1. #!json
  2. 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
email 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:
  1. #!shell
  2. curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' \
  3. -d '{
  4. "name":"API",
  5. "email":"api@realtyna.com",
  6. "password":"123321aA",
  7. "re-password":"123321aA",
  8. "phone":"+31232342342"
  9. }' /wp-json/wpl_api/v1/register
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "User is created successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): name, email, password, re-password",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "name",
  9. "email",
  10. "password",
  11. "re-password"
  12. ]
  13. }
  14. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "The Email is already registered. Try a different Email address."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Some or all of required filed entries are invalid."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "password and the repeat are not matching."
  6. }
  7. }

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
email string Y The user\’s email address
password stirng Y The client\’s password
  • Request:
  1. #!shell
  2. curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' \
  3. -d '{
  4. "email":"api@realtyna.com",
  5. "password":"123321aA"
  6. }' /wp-json/wpl_api/v1/login
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Authentication passed successfully.",
  6. "user_id": 11
  7. }
  8. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): email, password",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "email",
  9. "password"
  10. ]
  11. }
  12. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Authentication failed."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"email":"api@realtyna.com","phone":"+8273648723468"}' /wp-json/wpl_api/v1/reset-password
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Sms Code sent successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): email, phone",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "email",
  9. "phone"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): email",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "email": "Invalid email address."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Phone number is wrong."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" -X POST -H 'Content-Type: application/json' -d '{"email":"api@realtyna.com","code":"5684","password":"123321aA","re-password":"123321aA"}' /wp-json/wpl_api/v1/change-password
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Password changed successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): code, email, password, re-password",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "code",
  9. "email",
  10. "password",
  11. "re-password"
  12. ]
  13. }
  14. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): email",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "email": "Invalid email address."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Sms Code is incorrect."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Some or all of required filed entries are invalid."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/listing_types
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "types": [
  6. {
  7. "id": "9",
  8. "name": "For Sale"
  9. },
  10. {
  11. "id": "10",
  12. "name": "For Rent"
  13. },
  14. {
  15. "id": "12",
  16. "name": "Vacation Rental"
  17. }
  18. ]
  19. }
  20. }
  • Error Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "properties": [
  6. {
  7. "id": "1499",
  8. "bathrooms": "7",
  9. "bedrooms": "5",
  10. "price": "$6.5M",
  11. "description": "FURNISHED ESTATE! Orlando",
  12. "images": [
  13. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1499/MLS1.jpg"
  14. ],
  15. "longitude": "-81.514227",
  16. "latitude": "28.445112"
  17. }
  18. ]
  19. }
  20. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): listing_type, swlat, swlng, nelat, nelng",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "listing_type",
  9. "swlat",
  10. "swlng",
  11. "nelat",
  12. "nelng"
  13. ]
  14. }
  15. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No property could be found."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "id": "68",
  6. "bathrooms": "2",
  7. "bedrooms": "2",
  8. "price": "$85.4K",
  9. "description": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod...",
  10. "images_count": "3",
  11. "sqft": "269Sqft",
  12. "lot_size": "3000Sqft",
  13. "images": [
  14. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/iStock-496916252.jpg",
  15. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl02.png",
  16. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl07.png"
  17. ],
  18. "type": "Commercial For sale",
  19. "location_text": "Laramie County, Wyoming",
  20. "longitude": "-104.84546190000003",
  21. "latitude": "41.4269559",
  22. "agent_info": {
  23. "agent": "Developer R",
  24. "company": "Realtyna",
  25. "tel": "+ (123) 4567234234",
  26. "email": "alan@realtyna.com",
  27. "image": "http://wpl28.realtyna.com/wp-content/uploads/WPL/users/42/profile.png"
  28. }
  29. }
  30. }
  • Error Responses:

  • Code: 400

  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): listing_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "listing_id": "listing_id is not of type integer."
  9. }
  10. }
  11. }
  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): listing_id",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "listing_id"
  9. ]
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Listing with this ID: 13214234 could not be found."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/mls/AC1234234B
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "id": "68",
  6. "bathrooms": "2",
  7. "bedrooms": "2",
  8. "price": "$85.4K",
  9. "description": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod...",
  10. "images_count": "3",
  11. "sqft": "269Sqft",
  12. "lot_size": "3000Sqft",
  13. "images": [
  14. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/iStock-496916252.jpg",
  15. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl02.png",
  16. "http://wpl28.realtyna.com/wp-content/uploads/WPL/68/pl07.png"
  17. ],
  18. "type": "Commercial For sale",
  19. "location_text": "Laramie County, Wyoming",
  20. "longitude": "-104.84546190000003",
  21. "latitude": "41.4269559",
  22. "agent_info": {
  23. "agent": "Developer R",
  24. "company": "Realtyna",
  25. "tel": "+ (123) 4567234234",
  26. "email": "alan@realtyna.com",
  27. "image": "http://wpl28.realtyna.com/wp-content/uploads/WPL/users/42/profile.png"
  28. }
  29. }
  30. }
  • Error Responses:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Listing with this MLS ID: AC1234234A could not be found."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/filter
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "items": [
  6. {
  7. "name": "Listing Type",
  8. "type": "DropDown",
  9. "key": "listing_type",
  10. "results": [
  11. {
  12. "id": "-1",
  13. "type": "Any"
  14. },
  15. {
  16. "id": "9",
  17. "type": "For Sale"
  18. },
  19. {
  20. "id": "10",
  21. "type": "For Rent"
  22. },
  23. {
  24. "id": "12",
  25. "type": "Vacation Rental"
  26. }
  27. ]
  28. },
  29. {
  30. "name": "Property Type",
  31. "type": "DropDown",
  32. "key": "property_type",
  33. "results": [
  34. {
  35. "id": "-1",
  36. "type": "Any"
  37. },
  38. {
  39. "id": "6",
  40. "type": "Apartment"
  41. },
  42. {
  43. "id": "7",
  44. "type": "Villa"
  45. },
  46. {
  47. "id": "13",
  48. "type": "Office"
  49. },
  50. {
  51. "id": "14",
  52. "type": "Land"
  53. }
  54. ]
  55. },
  56. {
  57. "name": "Bedrooms",
  58. "type": "Tabs",
  59. "key": "bedroom",
  60. "results": [
  61. {
  62. "text": "ANY",
  63. "min": "0",
  64. "max": "10",
  65. "selected": true
  66. },
  67. {
  68. "text": "+1",
  69. "min": "1",
  70. "max": "10"
  71. },
  72. {
  73. "text": "+2",
  74. "min": "2",
  75. "max": "10"
  76. },
  77. {
  78. "text": "+3",
  79. "min": "3",
  80. "max": "10"
  81. },
  82. {
  83. "text": "+4",
  84. "min": "4",
  85. "max": "10"
  86. },
  87. {
  88. "text": "+5",
  89. "min": "5",
  90. "max": "10"
  91. }
  92. ]
  93. },
  94. {
  95. "name": "Bathrooms",
  96. "type": "Tabs",
  97. "key": "bathroom",
  98. "results": [
  99. {
  100. "text": "ANY",
  101. "min": "0",
  102. "max": "10",
  103. "selected": true
  104. },
  105. {
  106. "text": "+1",
  107. "min": "1",
  108. "max": "10"
  109. },
  110. {
  111. "text": "+2",
  112. "min": "2",
  113. "max": "10"
  114. },
  115. {
  116. "text": "+3",
  117. "min": "3",
  118. "max": "10"
  119. },
  120. {
  121. "text": "+4",
  122. "min": "4",
  123. "max": "10"
  124. },
  125. {
  126. "text": "+5",
  127. "min": "5",
  128. "max": "10"
  129. }
  130. ]
  131. },
  132. {
  133. "name": "Price Range",
  134. "type": "Input",
  135. "key": "price",
  136. "placeholders": [
  137. "min",
  138. "max"
  139. ]
  140. },
  141. {
  142. "name": "Living Area (Sqft)",
  143. "type": "Input",
  144. "key": "sqft",
  145. "placeholders": [
  146. "min",
  147. "max"
  148. ]
  149. },
  150. {
  151. "name": "Keywords",
  152. "type": "Input",
  153. "key": "keywords",
  154. "placeholders": [
  155. ""
  156. ]
  157. },
  158. {
  159. "name": "Tags",
  160. "type": "Checkbox",
  161. "key": "tags",
  162. "results": [
  163. "Featured",
  164. "Hot Offer",
  165. "Open House",
  166. "Foreclosure"
  167. ]
  168. },
  169. {
  170. "name": "Neighborhood",
  171. "type": "Checkbox",
  172. "key": "neighborhoods",
  173. "results": [
  174. "Shopping Center",
  175. "Hospital",
  176. "Cinema",
  177. "Park",
  178. "Beach",
  179. "Coffee Shop",
  180. "Airport",
  181. "Bus Station",
  182. "Train Station",
  183. "School",
  184. "University",
  185. "Police Station",
  186. "Town Center",
  187. "Exhibition",
  188. "Tourist Site"
  189. ]
  190. },
  191. {
  192. "name": "Appliances",
  193. "type": "Checkbox",
  194. "key": "appliances",
  195. "results": [
  196. "Heating System",
  197. "Swimming Pool",
  198. "Jacuzzi",
  199. "Elevator",
  200. "Cooling System",
  201. "Garden",
  202. "Balcony",
  203. "Basement",
  204. "Fence",
  205. "View",
  206. "Pet Policy",
  207. "Kitchen",
  208. "Steam",
  209. "Gymnasium",
  210. "Fireplace",
  211. "Patio",
  212. "Roof Deck",
  213. "High Ceiling",
  214. "Storage",
  215. "Parking",
  216. "Furnished",
  217. "Security",
  218. "Refrigerator",
  219. "Stove",
  220. "Microwave",
  221. "Washing Machine",
  222. "TV",
  223. "CD Player",
  224. "Internet",
  225. "Hair Dryer",
  226. "Cleaning Service",
  227. "Oven",
  228. "Dishwasher",
  229. "Dishes",
  230. "Satellite",
  231. "Telephone",
  232. "Towels",
  233. "Hot Tub",
  234. "Iron"
  235. ]
  236. }
  237. ]
  238. }
  239. }
  • Error Responses:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "properties": [
  6. {
  7. "id": "1499",
  8. "bathrooms": "7",
  9. "bedrooms": "5",
  10. "price": "$6.5M",
  11. "description": "FURNISHED ESTATE! Orlando",
  12. "images": [
  13. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1499/MLS1.jpg"
  14. ],
  15. "longitude": "-81.514227",
  16. "latitude": "28.445112"
  17. }
  18. ]
  19. }
  20. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): swlat, swlng, nelat, nelng",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "swlat",
  9. "swlng",
  10. "nelat",
  11. "nelng"
  12. ]
  13. }
  14. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No property could be found."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Property added in favorite list successfully.",
  6. "lastinsertId": "8"
  7. }
  8. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, listing_id",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id",
  9. "listing_id"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Sorry something went wrong!"
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "The listing is removed from Favorites successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, listing_id",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id",
  9. "listing_id"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "properties": [
  6. {
  7. "id": "45",
  8. "bathrooms": "1",
  9. "bedrooms": "2",
  10. "price": "$506K",
  11. "description": "",
  12. "images": [
  13. "http://wpl28.realtyna.com/wp-content/uploads/WPL/8.jpg"
  14. ],
  15. "longitude": "-84.514227",
  16. "latitude": "28.545112"
  17. },
  18. {
  19. "id": "44",
  20. "bathrooms": "2",
  21. "bedrooms": "3",
  22. "price": "$296K",
  23. "description": "",
  24. "images": [
  25. "http://wpl28.realtyna.com/wp-content/uploads/WPL/44/2.jpg"
  26. ],
  27. "longitude": "-81.514227",
  28. "latitude": "28.445112"
  29. }
  30. ],
  31. "info": {
  32. "current_page": 1,
  33. "next_page": 2,
  34. "previous_page": 1,
  35. "total_page": 1
  36. }
  37. }
  38. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, page",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id",
  9. "page"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id, page",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer.",
  9. "page": "page is not of type integer."
  10. }
  11. }
  12. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No property cound be found."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "The search is saved successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, zoom, name, latitude, longitude",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id",
  9. "zoom",
  10. "name",
  11. "latitude",
  12. "longitude"
  13. ]
  14. }
  15. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Saved search is removed successfully."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, name",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id",
  9. "name"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Sorry something went wrong!"
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": [
  5. {
  6. "name": "California",
  7. "zoom": "10",
  8. "latitude": "23.76872341234",
  9. "longitude": "-121.82736478"
  10. },
  11. {
  12. "name": "TEST",
  13. "zoom": "10",
  14. "latitude": "23.76872341234",
  15. "longitude": "-121.82736478"
  16. }
  17. ]
  18. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): user_id, name",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "user_id"
  9. ]
  10. }
  11. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): user_id",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "user_id": "user_id is not of type integer."
  9. }
  10. }
  11. }
  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "User id does not exist."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No Saved Search could be found."
  6. }
  7. }

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:

  1. #!shell
  2. curl --header "Authorization: Bearer Token" /wp-json/wpl_api/v1/sort-options
  • Success Response:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "options": [
  6. {
  7. "id": "2",
  8. "name": "Price"
  9. },
  10. {
  11. "id": "3",
  12. "name": "Built up Area"
  13. },
  14. {
  15. "id": "6",
  16. "name": "Pictures"
  17. },
  18. {
  19. "id": "8",
  20. "name": "Property Type"
  21. },
  22. {
  23. "id": "9",
  24. "name": "Add date"
  25. },
  26. {
  27. "id": "13",
  28. "name": "Featured"
  29. },
  30. {
  31. "id": "31",
  32. "name": "Name"
  33. },
  34. {
  35. "id": "32",
  36. "name": "Country"
  37. },
  38. {
  39. "id": "50",
  40. "name": "Rank"
  41. }
  42. ]
  43. }
  44. }
  • Error Responses:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No Sort Options could be found."
  6. }
  7. }

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:

  1. #!shell
  2. 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:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "properties": [
  6. {
  7. "id": "2208",
  8. "bathrooms": "0",
  9. "bedrooms": "0",
  10. "price": "$25M",
  11. "description": "115.46 Acres (375 Lots) f",
  12. "images": [
  13. "http://wpl28.realtyna.com/wp-content/uploads/WPL/2208/iStock-500545264.jpg",
  14. "http://wpl28.realtyna.com/wp-content/uploads/WPL/2208/pl19.png"
  15. ],
  16. "longitude": "-81.247143",
  17. "latitude": "28.756668"
  18. },
  19. {
  20. "id": "1443",
  21. "bathrooms": "8",
  22. "bedrooms": "6",
  23. "price": "$19.9M",
  24. "description": "Magnificently poised on 2",
  25. "images": [
  26. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/iStock-175448020.jpg",
  27. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/pl18.png",
  28. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/pl19.png",
  29. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/MLS5.jpg",
  30. "http://wpl28.realtyna.com/wp-content/uploads/WPL/1443/MLS4.jpg"
  31. ],
  32. "longitude": "-82.679309",
  33. "latitude": "27.427891"
  34. }
  35. ],
  36. "info": {
  37. "current_page": 1,
  38. "next_page": 2,
  39. "previous_page": 1,
  40. "total_page": 57
  41. }
  42. }
  43. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): sort_id, page",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "sort_id",
  9. "page"
  10. ]
  11. }
  12. }
  1. #!json
  2. {
  3. "code": "rest_invalid_param",
  4. "message": "Invalid parameter(s): sort_id, page",
  5. "data": {
  6. "status": 400,
  7. "params": {
  8. "sort_id": "sort_id is not of type integer.",
  9. "page": "page is not of type integer."
  10. }
  11. }
  12. }
  • Error Responses:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Signature verification failed. Please generate token first."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "No property could be found."
  6. }
  7. }

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:
  1. #!json
  2. {
  3. "listing_type" : "For Rent",
  4. "property_type" : "Office",
  5. "price" : 1500,
  6. "price_unit" : "USD",
  7. "price_period" : "Per Week",
  8. "bedrooms" : 5,
  9. "bathrooms" : 5,
  10. "half_bathrooms" : 2,
  11. "square_footage" : 123.34,
  12. "square_footage_unit": "Sqft",
  13. "lot_area":2342,
  14. "lot_area_unit":"Sqft",
  15. "year_built":1991,
  16. "address": [
  17. {
  18. "county":"United States",
  19. "state":"California",
  20. "city":"Los Angeles",
  21. "zipcode":"94025",
  22. "street":"Hacker Way",
  23. "street_number":"100110111"
  24. }
  25. ],
  26. "image": [
  27. "Image source url.",
  28. "Image source url."
  29. ]
  30. }
  • Request:
  1. #!shell
  2. curl -H 'Content-Type: application/json' --header \
  3. "Authorization: Bearer Token" \
  4. -X POST -d '{
  5. "listing_type" : "For Rent",
  6. "property_type" : "Office",
  7. "price" : 1500,
  8. "price_unit" : "USD",
  9. "price_period" : "Per Week",
  10. "bedrooms" : 10,
  11. "bathrooms" : 5,
  12. "half_bathrooms" : 2,
  13. "square_footage" : 123.34,
  14. "square_footage_unit": "Sqft",
  15. "lot_area":2342,
  16. "lot_area_unit":"Sqft",
  17. "year_built":1991,
  18. "address": [
  19. {
  20. "county":"United States",
  21. "state":"California",
  22. "city":"Los Angeles",
  23. "zipcode":"94025",
  24. "street":"Hacker Way",
  25. "street_number":"100110111"
  26. }
  27. ],
  28. "image": [
  29. "Image source url.",
  30. "Image source url."
  31. ]
  32. }' wp-json/wpl_api/v1/add-listing
  • Success Response:

  • Code: 201

Content:

  1. #!json
  2. {
  3. "success": true,
  4. "data": {
  5. "message": "Property successfully added."
  6. }
  7. }
  • Error Responses:

  • Code: 400

Content:

  1. #!json
  2. {
  3. "code": "rest_missing_callback_param",
  4. "message": "Missing parameter(s): listing_type,property_type,price,price_unit,address,image",
  5. "data": {
  6. "status": 400,
  7. "params": [
  8. "listing_type",
  9. "property_type",
  10. "price",
  11. "price_unit",
  12. "address",
  13. "image"
  14. ]
  15. }
  16. }
  • Error Responses:

  • Code: 200

Content:

  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Insert operation has failed."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Unknown Listing Type."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Unknown Property Type."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Array of Address is not valid."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Price Period is not valid."
  6. }
  7. }
  1. #!json
  2. {
  3. "success": false,
  4. "data": {
  5. "message": "Unknown unit type of price."
  6. }
  7. }