<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to update feature layer from a wordpress custom post type. Error 400 in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1401022#M4707</link>
    <description>&lt;P&gt;Thanks, but I dont think it has anything to do with the size of the array.&amp;nbsp; I tried several options with less fields as in the first code block above and continue to get the same error.&amp;nbsp; In fact I tried with just the geometry and address and still get the error. I get the same error no matter if I try submitting through postman, curl or direct API.&amp;nbsp; I think perhaps it might be a permissions issue or something un-related to my code?&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2024 17:20:41 GMT</pubDate>
    <dc:creator>JeffKurzner</dc:creator>
    <dc:date>2024-03-26T17:20:41Z</dc:date>
    <item>
      <title>Trying to update feature layer from a wordpress custom post type. Error 400</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1400694#M4705</link>
      <description>&lt;P&gt;Relatively new to the ArcGIS platform and am having difficulty trying to add to a feature datalayer used to plot points on a map.&amp;nbsp; I was able to create a Wordpress template to display a map and add, edit and delete feature points that represent custom post types in Wordpress.&amp;nbsp; I wrote a plug-in to do that using the REST API but I am getting an error 400.&amp;nbsp; I used the parameters to create the same request in postman and I get the same error so I don't think it is my plug-in code but something with accessing the API.&amp;nbsp; The format of my post is&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;&lt;A href="https://services6.arcgis.com/ZZRuFbElIjfqGwkv/arcgis/rest/services/wp_comreal_listings/FeatureServer/0/addFeatures?token=MY-API-TOKEN&amp;amp;f=json" target="_blank"&gt;https://services6.arcgis.com/ZZRuFbElIjfqGwkv/arcgis/rest/services/wp_comreal_listings/FeatureServer/0/addFeatures?token=MY-API-TOKEN&amp;amp;f=json&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The body in JSON would be something like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "features": [
    {
      "attributes": {
         "property_address": "645 San Lorenzo Ave",
        "property_name": "test",
        "city": "Miami",
        "state": "FL",
        "zip": "33146",
        "lat": 25.731574741741348,
        "lon": -80.2659019000002
      },
      "geometry": {
        "x": -80.2659019000002,
        "y": 25.731574741741348
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;but my response is&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"error":{"code":400,"message":"","details":["Invalid parameters"]}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My plug-in code is&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;&amp;lt;?php
/**
 * Plugin Name: ArcGIS Update Feature Layer
 * Plugin URI: https://mindshaft.com/
 * Description: Updates ArcGIS feature layer when a property is saved or deleted.
 * Version: 1.0.0
 * Author: Mindshaft LLC
 * Author URI: https://mindshaft.com/
 * Text Domain: arcgis-update-feature-layer
 * Domain Path: /languages
 */

// Function to update ArcGIS feature layer when a property is saved or deleted
function update_arcgis_feature_layer($post_id) {
    // Check if this is a property post type
    if (get_post_type($post_id) === 'listings') {
        // Fetch property data
        $property_title = get_the_title($post_id);
		$FeatureImage = get_the_post_thumbnail_url( $post_id, 'medium' );
        $property_address = get_post_meta($post_id, 'property_address', true);
        $property_name = get_post_meta($post_id, 'property_name', true);
        $property_type = get_post_meta($post_id, 'property_type', true);
        $star_rating = get_post_meta($post_id, 'star_rating', true);
        $energy_star = get_post_meta($post_id, 'energy_star', true);
        $leed_certified = get_post_meta($post_id, 'leed_certified', true);
        $building_class = get_post_meta($post_id, 'building_class', true);
        $building_status = get_post_meta($post_id, 'building_status', true);
        $rba = get_post_meta($post_id, 'rba', true);
        $total_available_space_sf = get_post_meta($post_id, 'total_available_space_sf', true);
        $rentsfyr = get_post_meta($post_id, 'rentsfyr', true);
        $secondary_type = get_post_meta($post_id, 'secondary_type', true);
        $market_name = get_post_meta($post_id, 'market_name', true);
        $submarket_name = get_post_meta($post_id, 'submarket_name', true);
        $leasing_company_name = get_post_meta($post_id, 'leasing_company_name', true);
        $leasing_company_contact = get_post_meta($post_id, 'leasing_company_contact', true);
        $submarket_cluster = get_post_meta($post_id, 'submarket_cluster', true);
        $city = get_post_meta($post_id, 'city', true);
        $state = get_post_meta($post_id, 'state', true);
        $zip = get_post_meta($post_id, 'zip', true);
        $county_name = get_post_meta($post_id, 'county_name', true);
        $sale_company_name = get_post_meta($post_id, 'sale_company_name', true);
        $sale_company_contact = get_post_meta($post_id, 'sale_company_contact', true);
        $for_sale_price = get_post_meta($post_id, 'for_sale_price', true);
        $for_sale_status = get_post_meta($post_id, 'for_sale_status', true);
        $last_sale_date = get_post_meta($post_id, 'last_sale_date', true);
        $last_sale_price = get_post_meta($post_id, 'last_sale_price', true);
        $percent_leased = get_post_meta($post_id, 'percent_leased', true);
        $year_built = get_post_meta($post_id, 'year_built', true);
        $year_renovated = get_post_meta($post_id, 'year_renovated', true);
        $typical_floor_size = get_post_meta($post_id, 'typical_floor_size', true);
        $parking_ratio = get_post_meta($post_id, 'parking_ratio', true);
        $tenancy = get_post_meta($post_id, 'tenancy', true);
        $fema_map_date = get_post_meta($post_id, 'fema_map_date', true);
        $fema_map_identifier = get_post_meta($post_id, 'fema_map_identifier', true);
        $firm_id = get_post_meta($post_id, 'firm_id', true);
        $firm_panel_number = get_post_meta($post_id, 'firm_panel_number', true);
        $in_sfha = get_post_meta($post_id, 'in_sfha', true);
        $floodplain_area = get_post_meta($post_id, 'floodplain_area', true);
        $latitude = get_post_meta($post_id, 'lat', true);
        $longitude = get_post_meta($post_id, 'lon', true);
		
		// Log field values
error_log("Property Title: " . $property_title . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Feature Image URL: ' . $FeatureImage . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Property Address: ' . $property_address . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Property Name: ' . $property_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Property Type: ' . $property_type . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Star Rating: ' . $star_rating . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Energy Star: ' . $energy_star . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('LEED Certified: ' . $leed_certified . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Building Class: ' . $building_class . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Building Status: ' . $building_status . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('RBA: ' . $rba . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Total Available Space (SF): ' . $total_available_space_sf . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Rent (SF/YR): ' . $rentsfyr . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Secondary Type: ' . $secondary_type . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Market Name: ' . $market_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Submarket Name: ' . $submarket_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Leasing Company Name: ' . $leasing_company_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Leasing Company Contact: ' . $leasing_company_contact . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Submarket Cluster: ' . $submarket_cluster . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('City: ' . $city, 3, ABSPATH . 'wp-content/debug.log');
error_log('State: ' . $state, 3, ABSPATH . 'wp-content/debug.log');
error_log('ZIP: ' . $zip, 3, ABSPATH . 'wp-content/debug.log');
error_log('County Name: ' . $county_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Sale Company Name: ' . $sale_company_name . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Sale Company Contact: ' . $sale_company_contact . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('For Sale Price: ' . $for_sale_price . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('For Sale Status: ' . $for_sale_status . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Last Sale Date: ' . $last_sale_date . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Last Sale Price: ' . $last_sale_price . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Percent Leased: ' . $percent_leased . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Year Built: ' . $year_built . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Year Renovated: ' . $year_renovated . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Typical Floor Size: ' . $typical_floor_size . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Parking Ratio: ' . $parking_ratio . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Tenancy: ' . $tenancy . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('FEMA Map Date: ' . $fema_map_date . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('FEMA Map Identifier: ' . $fema_map_identifier . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Firm ID: ' . $firm_id . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Firm Panel Number: ' . $firm_panel_number . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('In SFHA: ' . $in_sfha . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Floodplain Area: ' . $floodplain_area . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Latitude: ' . $latitude . "\n", 3, ABSPATH . 'wp-content/debug.log');
error_log('Longitude: ' . $longitude . "\n", 3, ABSPATH . 'wp-content/debug.log');


        // Format property data for ArcGIS
$arcgis_data = array(
    'attributes' =&amp;gt; array(
        'PostID' =&amp;gt; $post_id,
        'FeatureImage' =&amp;gt; $FeatureImage ?: null,
        'property_address' =&amp;gt; $property_address,
        'property_name' =&amp;gt; $property_name ?: null,
        'property_type' =&amp;gt; $property_type ?: null,
        'star_rating' =&amp;gt; $star_rating !== '' ? floatval($star_rating) : null,
        'energy_star' =&amp;gt; $energy_star ?: null,
        'leed_certified' =&amp;gt; $leed_certified ?: null,
        'building_class' =&amp;gt; $building_class ?: null,
        'building_status' =&amp;gt; $building_status ?: null,
        'rba' =&amp;gt; $rba !== '' ? floatval($rba) : null,
        'total_available_space_sf' =&amp;gt; $total_available_space_sf !== '' ? floatval($total_available_space_sf) : null,
        'rentsfyr' =&amp;gt; $rentsfyr !== '' ? floatval($rentsfyr) : null,
        'secondary_type' =&amp;gt; $secondary_type ?: null,
        'market_name' =&amp;gt; $market_name ?: null,
        'submarket_name' =&amp;gt; $submarket_name ?: null,
        'leasing_company_name' =&amp;gt; $leasing_company_name ?: null,
        'leasing_company_contact' =&amp;gt; $leasing_company_contact ?: null,
        'submarket_cluster' =&amp;gt; $submarket_cluster ?: null,
        'city' =&amp;gt; $city ?: null,
        'state' =&amp;gt; $state ?: null,
        'zip' =&amp;gt; $zip ?: null,
        'county_name' =&amp;gt; $county_name ?: null,
        'sale_company_name' =&amp;gt; $sale_company_name ?: null,
        'sale_company_contact' =&amp;gt; $sale_company_contact ?: null,
        'for_sale_price' =&amp;gt; $for_sale_price !== '' ? floatval($for_sale_price) : null,
        'for_sale_status' =&amp;gt; $for_sale_status ?: null,
        'last_sale_date' =&amp;gt; $last_sale_date ?: null,
        'last_sale_price' =&amp;gt; $last_sale_price !== '' ? floatval($last_sale_price) : null,
        'percent_leased' =&amp;gt; $percent_leased !== '' ? floatval($percent_leased) : null,
        'year_built' =&amp;gt; $year_built !== '' ? intval($year_built) : null,
        'year_renovated' =&amp;gt; $year_renovated !== '' ? intval($year_renovated) : null,
        'typical_floor_size' =&amp;gt; $typical_floor_size !== '' ? floatval($typical_floor_size) : null,
        'parking_ratio' =&amp;gt; $parking_ratio ?: null,
        'tenancy' =&amp;gt; $tenancy ?: null,
        'fema_map_date' =&amp;gt; $fema_map_date ?: null,
        'fema_map_identifier' =&amp;gt; $fema_map_identifier ?: null,
        'firm_id' =&amp;gt; $firm_id ?: null,
        'firm_panel_number' =&amp;gt; $firm_panel_number ?: null,
        'in_sfha' =&amp;gt; $in_sfha ?: null,
        'floodplain_area' =&amp;gt; $floodplain_area ?: null,
        'lat' =&amp;gt; $latitude !== '' ? floatval($latitude) : null,
        'lon' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
    ),
    'geometry' =&amp;gt; array(
        'x' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
        'y' =&amp;gt; $latitude !== '' ? floatval($latitude) : null,
    )
);
 
	    // Log the ArcGIS data
		error_log("\n\nArcGIS data: " . json_encode($arcgis_data) . "\n\n", 3, ABSPATH . 'wp-content/debug.log');
        // Send data to ArcGIS REST API
        $arcgis_api_key = 'MY-API-TOKEN';
		$arcgis_url = 'MY-ARCGIS-SERVER-URL' . urlencode($arcgis_api_key);

        $headers = array(
            'Content-Type' =&amp;gt; 'application/json',
        );

        $body = array(
            'features' =&amp;gt; array($arcgis_data)
        );

        // Log the request body
        error_log('Request body: ' . json_encode($body) . "\n\n", 3, ABSPATH . 'wp-content/debug.log');


        $response = wp_remote_post($arcgis_url, array(
            'headers' =&amp;gt; $headers,
            'body' =&amp;gt; json_encode($body),
        ));

        // Log the API response
        error_log('API response: ' . wp_remote_retrieve_body($response) . "\n\n", 3, ABSPATH . 'wp-content/debug.log');

		
        // Check for errors
        if (is_wp_error($response)) {
            error_log('Error updating ArcGIS feature layer: ' . $response-&amp;gt;get_error_message() . "\n\n", 3, ABSPATH . 'wp-content/debug.log');

        } else {
            $response_body = json_decode(wp_remote_retrieve_body($response), true);
            if (isset($response_body['error'])) {
                error_log('Error updating ArcGIS feature layer: ' . $response_body['error']['message'] . "\n\n", 3, ABSPATH . 'wp-content/debug.log');

            } else {
                error_log('Feature layer updated successfully' . "\n\n", 3, ABSPATH . 'wp-content/debug.log');

            }
        }
    }
}

// Hook to update ArcGIS feature layer when a property is saved
add_action('acf/save_post', 'update_arcgis_feature_layer', 20);

// Hook to update ArcGIS feature layer when a property is deleted
add_action('delete_post', 'update_arcgis_feature_layer');
?&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Would love some help understanding what I'm doing wrong&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 01:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1400694#M4705</guid>
      <dc:creator>JeffKurzner</dc:creator>
      <dc:date>2024-03-26T01:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to update feature layer from a wordpress custom post type. Error 400</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1400954#M4706</link>
      <description>&lt;P&gt;Instead of building your array as one big overall statement, try building it in segments - print_r() is your friend as you walk through the process. Don't forget your token -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        // Format property data for ArcGIS
$arcgis_data = array(
    'attributes' =&amp;gt; array(&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try doing this ---&amp;nbsp;&lt;/P&gt;&lt;P&gt;$dataElements = [ Put your Attribute Elements here ];&lt;/P&gt;&lt;P&gt;Then do the next portion of the array&amp;nbsp;&lt;/P&gt;&lt;P&gt;$attributeData = ['attributes' =&amp;gt; Data Elements];&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, be sure you have all the control fields (right of ?) where you have previously built them and the&amp;nbsp; URL with the Token string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;$postData .= $fields . "&amp;amp;features" . json_encode($attributeDat);&lt;/P&gt;&lt;P&gt;And be sure to set your content length in the CUROPT_HTTPHEADER.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 15:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1400954#M4706</guid>
      <dc:creator>JeffSilberberg</dc:creator>
      <dc:date>2024-03-26T15:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to update feature layer from a wordpress custom post type. Error 400</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1401022#M4707</link>
      <description>&lt;P&gt;Thanks, but I dont think it has anything to do with the size of the array.&amp;nbsp; I tried several options with less fields as in the first code block above and continue to get the same error.&amp;nbsp; In fact I tried with just the geometry and address and still get the error. I get the same error no matter if I try submitting through postman, curl or direct API.&amp;nbsp; I think perhaps it might be a permissions issue or something un-related to my code?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:20:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1401022#M4707</guid>
      <dc:creator>JeffKurzner</dc:creator>
      <dc:date>2024-03-26T17:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to update feature layer from a wordpress custom post type. Error 400</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1401058#M4708</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not the size of the array it's the construct you need to place an array inside an array and json_encode as you go.&amp;nbsp; Try this and you will see the difference -&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;?php

$arcgis_data = array(
    'attributes' =&amp;gt; array(
        'PostID' =&amp;gt; $post_id,
        'FeatureImage' =&amp;gt; $FeatureImage ?: null,
        'property_address' =&amp;gt; $property_address,
        'property_name' =&amp;gt; $property_name ?: null,
        'property_type' =&amp;gt; $property_type ?: null,
        'star_rating' =&amp;gt; $star_rating !== '' ? floatval($star_rating) : null,
        'energy_star' =&amp;gt; $energy_star ?: null,
        'leed_certified' =&amp;gt; $leed_certified ?: null,
        'building_class' =&amp;gt; $building_class ?: null,
        'building_status' =&amp;gt; $building_status ?: null,
        'rba' =&amp;gt; $rba !== '' ? floatval($rba) : null,
        'total_available_space_sf' =&amp;gt; $total_available_space_sf !== '' ? floatval($total_available_space_sf) : null,
        'rentsfyr' =&amp;gt; $rentsfyr !== '' ? floatval($rentsfyr) : null,
        'secondary_type' =&amp;gt; $secondary_type ?: null,
        'market_name' =&amp;gt; $market_name ?: null,
        'submarket_name' =&amp;gt; $submarket_name ?: null,
        'leasing_company_name' =&amp;gt; $leasing_company_name ?: null,
        'leasing_company_contact' =&amp;gt; $leasing_company_contact ?: null,
        'submarket_cluster' =&amp;gt; $submarket_cluster ?: null,
        'city' =&amp;gt; $city ?: null,
        'state' =&amp;gt; $state ?: null,
        'zip' =&amp;gt; $zip ?: null,
        'county_name' =&amp;gt; $county_name ?: null,
        'sale_company_name' =&amp;gt; $sale_company_name ?: null,
        'sale_company_contact' =&amp;gt; $sale_company_contact ?: null,
        'for_sale_price' =&amp;gt; $for_sale_price !== '' ? floatval($for_sale_price) : null,
        'for_sale_status' =&amp;gt; $for_sale_status ?: null,
        'last_sale_date' =&amp;gt; $last_sale_date ?: null,
        'last_sale_price' =&amp;gt; $last_sale_price !== '' ? floatval($last_sale_price) : null,
        'percent_leased' =&amp;gt; $percent_leased !== '' ? floatval($percent_leased) : null,
        'year_built' =&amp;gt; $year_built !== '' ? intval($year_built) : null,
        'year_renovated' =&amp;gt; $year_renovated !== '' ? intval($year_renovated) : null,
        'typical_floor_size' =&amp;gt; $typical_floor_size !== '' ? floatval($typical_floor_size) : null,
        'parking_ratio' =&amp;gt; $parking_ratio ?: null,
        'tenancy' =&amp;gt; $tenancy ?: null,
        'fema_map_date' =&amp;gt; $fema_map_date ?: null,
        'fema_map_identifier' =&amp;gt; $fema_map_identifier ?: null,
        'firm_id' =&amp;gt; $firm_id ?: null,
        'firm_panel_number' =&amp;gt; $firm_panel_number ?: null,
        'in_sfha' =&amp;gt; $in_sfha ?: null,
        'floodplain_area' =&amp;gt; $floodplain_area ?: null,
        'lat' =&amp;gt; $latitude !== '' ? floatval($latitude) : null,
        'lon' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
    ),
    'geometry' =&amp;gt; array(
        'x' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
        'y' =&amp;gt; $latitude !== '' ? floatval($latitude) : null,
    )
);

    printf("Your Data Arrays \n");
    print_r($arcgis_data);
    printf("\n");

    $dataElements = array (
        'PostID' =&amp;gt; $post_id,
        'FeatureImage' =&amp;gt; $FeatureImage ?: null,
        'property_address' =&amp;gt; $property_address,
        'property_name' =&amp;gt; $property_name ?: null,
        'property_type' =&amp;gt; $property_type ?: null,
        'star_rating' =&amp;gt; $star_rating !== '' ? floatval($star_rating) : null,
        'energy_star' =&amp;gt; $energy_star ?: null,
        'leed_certified' =&amp;gt; $leed_certified ?: null,
        'building_class' =&amp;gt; $building_class ?: null,
        'building_status' =&amp;gt; $building_status ?: null,
        'rba' =&amp;gt; $rba !== '' ? floatval($rba) : null,
        'total_available_space_sf' =&amp;gt; $total_available_space_sf !== '' ? floatval($total_available_space_sf) : null,
        'rentsfyr' =&amp;gt; $rentsfyr !== '' ? floatval($rentsfyr) : null,
        'secondary_type' =&amp;gt; $secondary_type ?: null,
        'market_name' =&amp;gt; $market_name ?: null,
        'submarket_name' =&amp;gt; $submarket_name ?: null,
        'leasing_company_name' =&amp;gt; $leasing_company_name ?: null,
        'leasing_company_contact' =&amp;gt; $leasing_company_contact ?: null,
        'submarket_cluster' =&amp;gt; $submarket_cluster ?: null,
        'city' =&amp;gt; $city ?: null,
        'state' =&amp;gt; $state ?: null,
        'zip' =&amp;gt; $zip ?: null,
        'county_name' =&amp;gt; $county_name ?: null,
        'sale_company_name' =&amp;gt; $sale_company_name ?: null,
        'sale_company_contact' =&amp;gt; $sale_company_contact ?: null,
        'for_sale_price' =&amp;gt; $for_sale_price !== '' ? floatval($for_sale_price) : null,
        'for_sale_status' =&amp;gt; $for_sale_status ?: null,
        'last_sale_date' =&amp;gt; $last_sale_date ?: null,
        'last_sale_price' =&amp;gt; $last_sale_price !== '' ? floatval($last_sale_price) : null,
        'percent_leased' =&amp;gt; $percent_leased !== '' ? floatval($percent_leased) : null,
        'year_built' =&amp;gt; $year_built !== '' ? intval($year_built) : null,
        'year_renovated' =&amp;gt; $year_renovated !== '' ? intval($year_renovated) : null,
        'typical_floor_size' =&amp;gt; $typical_floor_size !== '' ? floatval($typical_floor_size) : null,
        'parking_ratio' =&amp;gt; $parking_ratio ?: null,
        'tenancy' =&amp;gt; $tenancy ?: null,
        'fema_map_date' =&amp;gt; $fema_map_date ?: null,
        'fema_map_identifier' =&amp;gt; $fema_map_identifier ?: null,
        'firm_id' =&amp;gt; $firm_id ?: null,
        'firm_panel_number' =&amp;gt; $firm_panel_number ?: null,
        'in_sfha' =&amp;gt; $in_sfha ?: null,
        'floodplain_area' =&amp;gt; $floodplain_area ?: null,
        'lat' =&amp;gt; $latitude !== '' ? floatval($latitude) : null,
        'lon' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
    );

    $geoElements = array(
        'x' =&amp;gt; $longitude !== '' ? floatval($longitude) : null,
        'y' =&amp;gt; $latitude !== '' ? floatval($latitude) : null
    );

    $attributeData = json_encode(array_merge(['attributes' =&amp;gt; $dataElements],['goeometry' =&amp;gt; $geoElements]));

    printf("Individual  Arrays \n");
    print_r($dataElements);
    print_r($geoElements);

    printf("Combined  Arrays \n");
    print_r($attributeData);
    printf("\n");

   $bearerToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
   $fields = "token=" . $bearerToken;
   $fields .= "&amp;amp;f=pjson&amp;amp;rollbackOnFailure=true";
   $postData = $fields . "&amp;amp;features=" . json_encode($attributeData);
   printf("\n");


    printf("Post Data for CURL \n");
    print_r($postData);
    printf("\n");

?&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 18:20:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/trying-to-update-feature-layer-from-a-wordpress/m-p/1401058#M4708</guid>
      <dc:creator>JeffSilberberg</dc:creator>
      <dc:date>2024-03-26T18:20:15Z</dc:date>
    </item>
  </channel>
</rss>

