Shalim_Uddin | 2022-03-15 15:11:45 UTC | #1
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": { "linemanagertext": "Jane Doe", "linemanagerphone_text": "98765432198" } }
Any help or guidance will be appreciated.
Jerome.Saint-Marc | 2022-03-15 15:36:09 UTC | #2
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": { "linemanagertext": "Jane Doe", "linemanagerphone_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,
Shalim_Uddin | 2022-03-15 16:50:06 UTC | #3
Great thank you, that works.
system | 2022-04-15 16:51:01 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 13926