infobipinfobip-api

Infobip API. How to create list of list of objects by api


I would like to create custom attribute list of list of objects in Infobip by API. I have try to sent POST but in doesn't work. Can you give me please the example of POST request to create the list of the list. Thx! Off Doc: https://www.infobip.com/docs/api#customer-engagement/people/create-a-custom-attribute

Request examples:

1.{
   "name": "payrollData",
   "dataType": "LIST_OF_OBJECTS",
   "objectSchema": {
      "DATE": "DATE",
      "Transactions": "LIST_OF_OBJECTS"
   }
}

2.{
   "name": "payrollData",
   "dataType": "LIST_OF_OBJECTS",
   "objectSchema": {
      "DATE": "DATE",
      "Transactions":{
          "Input": "DECIMAL",
          "Output": "DECIMAL"
      }
   }
}

Responses:

1.{
    "errorCode": 40001,
    "errorMessage": "Bad Request",
    "validationErrors": [
        {
            "code": 501,
            "message": "Custom attribute schema is invalid.",
            "propertyPath": "valueSchema"
        }
    ]
}


2.{
    "requestError": {
        "serviceException": {
            "messageId": "BAD_REQUEST",
            "text": "Bad request"
        }
    }
}

Solution

  • At this point is not possible to achieve what you are trying via using Infobip API.

    The functionality for creating custom attributes is limited only to top layer and does not support nesting of the list objects.

    The team in charge will include that explanation in API docs description. But, there are no plans on including additional complexity layers on this endpoint in the short future.

    So generally, you can use LIST_OF_OBJECTS as described on the endpoint URL you also linked to. But you are not able to layer it furthermore.

    Valid example for LIST_OF_OBJECTS usage:

    {
      "name": "ShoppingCartList",
      "dataType": "LIST_OF_OBJECTS",
      "objectSchema": {
        "productName": "STRING",
        "productPrice": "DECIMAL",
        "productCategory": "STRING",
        "productImage": "STRING"
      }
    }
    

    I know it does not resolve your issue as you would have hoped for, but it is a correct answer. :)