Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  External Contact creation using the API

    Posted 12-10-2020 18:54
    No replies, thread closed.
    Hi,

    I'm trying to make a test using the API Explorer in order to create a new External Contact:

    /api/v2/externalcontacts/contacts

    While attempting to create this new External Contact, completed the "required" fields, with some test informations.
    Please find below what has been managed:
    {
    "firstName": "Juan",
    "middleName": "José",
    "lastName": "López",
    "salutation": "Sr.",
    "title": "DT",
    "workPhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "cellPhone": {
    "display": "+541141114444",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "+541141114444",
    "countryCode": "AR"
    },
    "homePhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "otherPhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "workEmail": "jjlopez@carp.com.ar",
    "personalEmail": "",
    "otherEmail": "",
    "address": {
    "address1": "Av. Figueroa Alcorta 6800",
    "address2": "",
    "city": "Buenos Aires",
    "state": "CABA",
    "postalCode": "8888",
    "countryCode": "AR"
    },
    "twitterId": {
    "id": "1",
    "name": "1",
    "screenName": "1"
    },
    "lineId": {
    "ids": [
    {
    "userId": "1"
    }
    ],
    "displayName": "Juan José López"
    },
    "whatsAppId": {
    "phoneNumber": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "displayName": "-"
    },
    "facebookId": {
    "ids": [
    {
    "scopedId": "1"
    }
    ],
    "displayName": "1"
    },
    "modifyDate": "",
    "createDate": "",
    "externalOrganization": {
    "id": "1",
    "name": "CARP",
    "companyType": "",
    "industry": "",
    "primaryContactId": "",
    "address": {
    "address1": "",
    "address2": "",
    "city": "",
    "state": "",
    "postalCode": "",
    "countryCode": ""
    },
    "phoneNumber": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "faxNumber": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "employeeCount": 0,
    "revenue": 0,
    "tags": [],
    "websites": [],
    "tickers": [
    {
    "symbol": "",
    "exchange": ""
    }
    ],
    "twitterId": {
    "id": "1",
    "name": "",
    "screenName": "1"
    },
    "externalSystemUrl": "",
    "modifyDate": "",
    "createDate": "",
    "trustor": {
    "enabled": true
    },
    "schema": {
    "name": "",
    "version": 1,
    "enabled": true,
    "jsonSchema": {
    "id": "",
    "$schema": "",
    "title": "",
    "description": "",
    "type": "",
    "required": [],
    "properties": {},
    "additionalProperties": {}
    }
    },
    "customFields": {}
    },
    "surveyOptOut": true,
    "externalSystemUrl": "",
    "schema": {
    "name": "",
    "version": 1,
    "enabled": true,
    "jsonSchema": {
    "id": "",
    "$schema": "",
    "title": "",
    "description": "",
    "type": "",
    "required": [],
    "properties": {},
    "additionalProperties": {}
    }
    },
    "customFields": {}
    }

    But wihile sending the request the answer is the following:

    422 error

    HEADERS

    cache-control
    no-cache, no-store, must-revalidate
    content-length
    198
    content-type
    application/json
    expires
    0
    inin-correlation-id
    6867efc7-07df-4f22-a035-df9a1fd1e19e
    inin-ratelimit-allowed
    300
    inin-ratelimit-count
    1
    inin-ratelimit-reset
    61
    pragma
    no-cache

    And:with the following body:

    {
    "message": "A schema ID must be specified when using customFields.",
    "code": "custom.fields.validation.failed",
    "status": 422,
    "contextId": "eb9a789f-304d-4336-96d8-7d393e2a69f6",
    "details": [],
    "errors": []
    }
    Need to know how to correct this error, as when I try to consult nay schema associated to the External Contacts, there's nothing (I have configured manually one External Contact before attempting to create a second one using the API Explorer:

    The result of the External Contacts consultation using the APiI (

    /api/v2/externalcontacts/contacts


    is the following:

    {
    "entities": [
    {
    "id": "7a168918-5ae3-4707-b432-281fa198c77c",
    "firstName": "Jorge",
    "middleName": "Marcelo",
    "lastName": "Negri",
    "modifyDate": "2020-07-28T15:51:45Z",
    "createDate": "2020-07-28T15:51:45Z",
    "surveyOptOut": false,
    "selfUri": "/api/v2/externalcontacts/contacts/7a168918-5ae3-4707-b432-281fa198c77c"
    }
    ],
    "pageSize": 20,
    "pageNumber": 1,
    "total": 1,
    "firstUri": "/api/v2/externalcontacts/contacts?pageSize=20&pageNumber=1",
    "selfUri": "/api/v2/externalcontacts/contacts?pageSize=20&pageNumber=1",
    "lastUri": "/api/v2/externalcontacts/contacts?pageSize=20&pageNumber=1",
    "pageCount": 1
    }

    And furthermore, no Schemas can be found if consulted using the API:
    /api/v2/externalcontacts/contacts/schemas
    with the following response found after consulting these Schemas:

    200 OK

    HEADERS

    cache-control
    no-cache, no-store, must-revalidate
    content-length
    25
    content-type
    application/json
    expires
    0
    inin-correlation-id
    23fe81f2-3177-43af-ae25-53d25818d338
    inin-ratelimit-allowed
    300
    inin-ratelimit-count
    1
    inin-ratelimit-reset
    61
    pragma
    no-cache

    BODY

    {
    "total": 0,
    "entities": []
    }

    It would be also great if someone can provide an example of the minimum information that must be entered on the Body of the request, to create a simple External Contact using the corresponding API





    #Ask Me Anything (AMA)
    #Integrations
    #SystemAdministration

    ------------------------------
    Jorge Marcelo Negri
    Senior Project Consultant
    Genesys PureCloud Certified Associate
    In Motion Argentina
    Ciudad Autónoma de Buenos Aires
    Argentina
    ------------------------------


  • 2.  RE: External Contact creation using the API
    Best Answer

    Posted 12-11-2020 03:25
    No replies, thread closed.
    Hi Jorge,

    The minimum information you need to enter on this API appears to be the contacts firstname and lastname. Once these are populated the API submits. What I found in testing was that you need to remove a lot of content when not passing values against it. For example, you have the Whatsapp element in your text above so it's expected data to be passed but you aren't including anything.

    I have taken the data you supplied above and created the contact in our org for testing, the code used is shown below. As you'll see I removed the schema section completely along with anything else that I wasn't populating. The example below needs to have your Org ID for CARP added (highlighted with XXXX), but you should be able to submit Create Contact request then successfully.

    {
    "firstName": "Juan",
    "middleName": "Jose",
    "lastName": "Lopez",
    "salutation": "Sr.",
    "title": "DT",
    "workPhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "cellPhone": {
    "display": "+541141114444",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "+541141114444",
    "countryCode": "AR"
    },
    "homePhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "otherPhone": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "workEmail": "jjlopez@carp.com.ar",
    "personalEmail": "",
    "otherEmail": "",
    "address": {
    "address1": "Av. Figueroa Alcorta 6800",
    "address2": "",
    "city": "Buenos Aires",
    "state": "CABA",
    "postalCode": "8888",
    "countryCode": "AR"
    },
    "twitterId": {
    "id": "1",
    "name": "1",
    "screenName": "1"
    },
    "lineId": {
    "ids": [
    {
    "userId": "1"
    }
    ],
    "displayName": "Juan José López"
    },
    "facebookId": {
    "ids": [
    {
    "scopedId": "1"
    }
    ],
    "displayName": "1"
    },
    "modifyDate": "",
    "createDate": "",
    "externalOrganization": {
    "id": "XXXX",
    "name": "CARP",
    "companyType": "",
    "industry": "",
    "primaryContactId": "",
    "address": {
    "address1": "",
    "address2": "",
    "city": "",
    "state": "",
    "postalCode": "",
    "countryCode": ""
    },
    "phoneNumber": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "faxNumber": {
    "display": "",
    "extension": 0,
    "acceptsSMS": true,
    "userInput": "",
    "e164": "",
    "countryCode": ""
    },
    "employeeCount": 0,
    "revenue": 0,
    "tags": [],
    "websites": [],
    "tickers": [
    {
    "symbol": "",
    "exchange": ""
    }
    ],
    "twitterId": {
    "id": "1",
    "name": "",
    "screenName": "1"
    },
    "externalSystemUrl": "",
    "modifyDate": "",
    "createDate": "",
    "trustor": {
    "enabled": true
    }
    }
    }

    ------------------------------
    Gareth James
    CALLSCAN AUSTRALIA PTY. LTD.
    ------------------------------



  • 3.  RE: External Contact creation using the API

    Posted 12-11-2020 07:25
    No replies, thread closed.
    Thanks Gareth for your quick reply and help on my post.

    I'll be testing and see if I can go ahead with this taking into account your information.

    Regards.


    ------------------------------
    Jorge Marcelo Negri
    Senior Project Consultant
    Genesys PureCloud Certified Associate
    In Motion Argentina
    Ciudad Autónoma de Buenos Aires
    Argentina
    ------------------------------



  • 4.  RE: External Contact creation using the API

    Posted 12-11-2020 07:41
    No replies, thread closed.
    Hi,

    Just attempted to create a new External Contact, but found that it is mandatory to have the External Organization created before the creation of the External Contact (as it seems mandatory to have the External Organization ID available to be sent as one of the inputs to be completed on the Body of the request sent).

    If you create an External Contact manually you don't need to have it associated to an External Organization.

    Is there any way to avoid this problem and to have the contact created without and External Organization entered in the API request?

    I'll be also trying to do this on my side and see if I can find some solution for this (as our customer don't need to have their External Contacts associated to Ext. Organizations).

    Thanks again in advance for your help.

    Regards

    ------------------------------
    Jorge Marcelo Negri
    Senior Project Consultant
    Genesys PureCloud Certified Associate
    In Motion Argentina
    Ciudad Autónoma de Buenos Aires
    Argentina
    ------------------------------



  • 5.  RE: External Contact creation using the API

    Posted 12-11-2020 07:46
    No replies, thread closed.
    Hi Jorge,

    If you delete the External Organisation section from the API request it will add the contact. My first test only passed in the very first section with user details. So any sections where you don’t have any data, or want to associate data should be removed.

    Kind Regards
    Gareth

    Sent from my iPhone




  • 6.  RE: External Contact creation using the API

    Posted 12-11-2020 08:46
    No replies, thread closed.
    Thanks again Gareth!

    I was finally able to delete the External Organization section, and then created an External Contact with minimun data.

    Regards,


    ------------------------------
    Jorge Marcelo Negri
    Senior Project Consultant
    Genesys PureCloud Certified Associate
    In Motion Argentina
    Ciudad Autónoma de Buenos Aires
    Argentina
    ------------------------------