Eugene
Eugene

Reputation: 61

Update records Zoho api v2 symbols

When I use the updateRecords method, to put new data into the fields in the zoho, some fields not updated. These fields have symbols in the title like '?' '/' '('
How to solve this problem?
Fields: "Date/Time" and "email_confirmed_?" empty, but "Last_Name" and "User_group" was updated and has data.

$header = array("Authorization:Zoho-oauthtoken $token", 'Content-Type: application/json');
$fields =  ["data"=> ["Last_Name" => "User Name",
                      "Date/Time"=>"2018-09-25T13:23:39+02:00",
                      "email_confirmed_?"=>"yes",
                      "User_group"=>"new user"]];

        $fields = json_encode($fields);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        $result =curl_exec($ch);
        curl_close($ch);

Upvotes: 0

Views: 396

Answers (1)

Mohamed El-Refaie
Mohamed El-Refaie

Reputation: 845

It seems you have assumed your custom fields API names. You could try "Field Meta Data" API to get the API name of your custom fields.

    {
        "custom_field": false,
        "lookup": {},
        "convert_mapping": {
            "Potentials": null,
            "Contacts": null,
            "Accounts": null
        },
        "visible": true,
        "field_label": "Lead Owner",
        "length": 120,
        "view_type": {
            "view": true,
            "edit": true,
            "quick_create": false,
            "create": true
        },
        "read_only": false,
        "api_name": "Owner",
        "unique": {},
        "data_type": "ownerlookup",
        "formula": {},
        "currency": {},
        "id": "410888000000000553",
        "decimal_place": null,
        "pick_list_values": [],
        "auto_number": {}
    }

The above is a sample response of the API. You can notice the difference between the "field_label" and "api_name".

Upvotes: 1

Related Questions