Unable to Populate External Contacts Custom Fields using API

I have added 2 custom fields to the External Contacts. I am now trying to populate these fields using the API, however, I keep getting a bad request error. I have tried from both the API Explorer and the direct API call but get the same error. Here is the body of the request:

{
"firstName": "Joe",
"lastName": "Bloggs",
"title": "Project Officer",
"workPhone": {
"display": "12345678912"
},
"workEmail": "joe.blogs@email.com",
"customFields": {
"line_manager_text": "Jane Doe",
"line_manager_phone_text": "98765432198"
}
}

Any help or guidance will be appreciated.

Hello,

Assuming that you are using the POST /api/v2/externalcontacts/contacts in your post above, you are missing the "schema" attribute.

You must include a reference to the External Contact schema (id and version) that you are leveraging for your External Contact custom fields - i.e. the schema of your "Custom Contact Type".

See here: https://developer.genesys.cloud/api/rest/v2/externalcontacts/overview#creating-a-new-external-entity-with-data-described-by-the-schema

Your request body should look like this:

{
    "firstName": "Joe",
    "lastName": "Bloggs",
    "schema": {
	    "id": "ID OF YOUR EXTERNAL CONTACT CUSTOM FIELDS SCHEMA",
	    "version": 2
	},
    "title": "Project Officer",
    "workPhone": {
        "display": "12345678912"
    },
    "workEmail": "joe.blogs@email.com",
    "customFields": {
        "line_manager_text": "Jane Doe",
        "line_manager_phone_text": "98765432198"
    }
}

You can access the list of schemas (id and version) using GET /api/v2/externalcontacts/contacts/schemas.
When referencing the schema in the request to create an external contact, make sure to reference the schema AND the schema current version (1, 2, ...).

Regards,

Great thank you, that works.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.