How to update meta fields (Real Homes – real estate theme) with an external app using REST API?
I have an app written in Delphi and Indy components for Windows platform, with which i can edit most of the data on my site using REST Api.
The site is working under WordPress, with Real Homes theme.
I need to load a property from this external application. I can modify, cities, types of properties, status, features, media, etc., but, i cannot get a way to register or modify a hole property.
I am very new with rest api.
I can GET properties data (something like this but with my app):
[http://openstreetmap.realhomes.io/wp-json/wp/v2/properties/45?_fields=id,date,slug,title,property_meta][1]
I can modify every default field but under property_meta i only can update (create & edit) fields with “something” format.
I cannot edit meta data that begin with REAL_HOMES and are the most important!
With Debug Meta Data plugin i get something like this:
_edit_last => 0 => 1string(1) "1"
_wp_page_template => 0 => defaultstring(7) "default"
REAL_HOMES_property_price => 0 => 70000string(5) "70000"
REAL_HOMES_property_size => 0 => 33.54string(5) "33.54"
REAL_HOMES_property_size_postfix => 0 => m²string(3) "m²"
REAL_HOMES_property_bathrooms => 0 => 1string(1) "1"
REAL_HOMES_property_id => 0 => RH-4851-propertystring(16) "RH-4851-property"
REAL_HOMES_featured => 0 => 0string(1) "0"
REAL_HOMES_property_location => 0 => -42.762602368439,-65.035119578456,18string(36) "-42.762602368439,-65.035119578456,18"
REAL_HOMES_property_address => 0 => Rawson Boulevard, Puerto Madryn, Departamento Biedma, Chubut, U9120, Argentinastring(78) "Rawson Boulevard, Puerto Madryn, Departamento Biedma, Chubut, U9120, Argentina"
REAL_HOMES_property_map => 0 => 0string(1) "0"
REAL_HOMES_change_gallery_slider_type => 0 => 0string(1) "0"
REAL_HOMES_gallery_slider_type => 0 => thumb-on-rightstring(14) "thumb-on-right"
REAL_HOMES_agent_display_option => 0 => nonestring(4) "none"
REAL_HOMES_energy_class => 0 => nonestring(4) "none"
REAL_HOMES_sticky => 0 => 0string(1) "0"
REAL_HOMES_add_in_slider => 0 => nostring(2) "no"
REAL_HOMES_hide_property_advance_search => 0 => 0string(1) "0"
inspiry_is_published => 0 => yesstring(3) "yes"
inspiry_video_group => 0 => a:1:{i:0;a:2:{s:25:"inspiry_video_group_image";a:1:{i:0;s:4:"4775";}s:23:"inspiry_video_group_url";s:60:"https://www.youtube.com/watch?v=cwUqkOcaRFU&feature=youtu.be";}}string(169) "a:1:{i:0;a:2:{s:25:"inspiry_video_group_image";a:1:{i:0;s:4:"4775";}s:23:"inspiry_video_group_url";s:60:"https://www.youtube.com/watch?v=cwUqkOcaRFU&feature=youtu.be";}}"
_thumbnail_id => 0 => 4775string(4) "4775"
REAL_HOMES_property_images => 0 => 4775string(4) "4775" 1 => 4769string(4) "4769" 2 => 4781string(4) "4781" 3 => 4780string(4) "4780" 4 => 4779string(4) "4779" 5 => 4778string(4) "4778" 6 => 4777string(4) "4777" 7 => 4776string(4) "4776"
REAL_HOMES_agents => 0 => -1string(2) "-1"
When i post something like this:
{
"slug": "property-test-home",
"status": "publish",
"title": "TEST HOME",
"content": "This is a test for the description of the property",
"excerpt": "This is a very short description",
"featured_media": 4933,
"comment_status": "closed",
"ping_status": "closed",
"template": "",
"property_features": [67],
"property_types": [73],
"property_cities": [92],
"property_estatus": [30],
"property_meta": {
"_thumbnail_id": [
"4933"
],
"REAL_HOMES_property_size": [
"64"
],
"REAL_HOMES_property_size_postfix": [
"m²"
],
"REAL_HOMES_property_bedrooms": [
"2"
],
"REAL_HOMES_property_bathrooms": [
"2"
],
"REAL_HOMES_property_garage": [
"1"
],
"REAL_HOMES_property_address": [
"Av. Siempre Viva 555, Springfield, United States"
],
"REAL_HOMES_property_images": [
"4933",
"4934",
"4935",
"4936"
]
}
It seems that POST is only taking in account property_meta._something fields.
(by the way, in Delphi code i try to send property_meta field as an JSONArray, as a JSONObject, and trying to set values to for example: REAL_HOMES_property_size, property_meta.REAL_HOMES_property_size, _property_size… but don’t get a clue).
Thanks for you help!
Answers ( 2 )
Hello, I have the same problem, did you find the answer, please?
I have the same problem with my website and the wordpress REST API, it seems to be a problem with the theme I am using. Currently I have opted to use Selenium.
Has anyone managed to fix this?