v1

latestOpenAPI 3.0.12026-07-24501176.6 MB

Associate Customer

Lets you batch register customers, or associate a customer with company or hierarchy. This API registers parent and child customers (if not registered), and associates the customer with hierarchy code, company role, parent and child customers.

post/customers/bulk

Headers

X-CAP-API-OAUTH-TOKENstring

Request body

RAW_BODYstring json

Response

200

childCountinteger
childFailureCountinteger
childSuccessCountinteger

Example response

[
  {
    "entity": {
      "id": 409966467,
      "profiles": [
        {
          "firstName": "Capillary",
          "lastName": "Customer",
          "attribution": {
            "createDate": "2021-07-30T11:25:21+05:30",
            "createdBy": {
              "id": 15071481,
              "code": "cm.1",
              "name": "cm.1",
              "type": "TILL",
              "adminType": "GENERAL",
              "isActive": true,
              "isOuEnabled": true,
              "currencyId": 95,
              "languageId": -1
            },
            "modifiedBy": {
              "id": 15071481,
              "code": "cm.1",
              "name": "cm.1",
              "type": "TILL",
              "adminType": "GENERAL",
              "isActive": true,
              "isOuEnabled": true,
              "currencyId": 95,
              "languageId": -1
            },
            "modifiedDate": "2021-07-30T11:25:21+05:30"
          },
          "fields": {
            "gender": "MALE"
          },
          "identifiers": [
            {
              "type": "mobile",
              "value": "917979015462"
            }
          ],
          "commChannels": [
            {
              "type": "mobile",
              "value": "917979000000",
              "primary": true,
              "verified": true
            }
          ],
          "source": "WECHAT",
          "userId": 409966467,
          "accountId": "WECHAT-CM",
          "autoUpdateTime": "2021-07-30T11:25:21+05:30",
          "identifiersAll": [
            {
              "type": "mobile",
              "value": "917979015462"
            }
          ]
        }
      ],
      "loyaltyInfo": {
        "loyaltyType": "loyalty"
      },
      "associationDetails": {
        "hierarchyCode": "code-association2",
        "hierarchyId": 21,
        "roleCode": "FA",
        "childCustomers": [
          {
            "profiles": [
              {
                "firstName": "Capillary",
                "lastName": "Customer",
                "attribution": {
                  "createDate": "2021-07-30T11:25:21+05:30",
                  "createdBy": {
                    "id": 15071481,
                    "code": "cm.1",
                    "name": "cm.1",
                    "type": "TILL",
                    "adminType": "GENERAL",
                    "isActive": true,
                    "isOuEnabled": true,
                    "currencyId": 95,
                    "languageId": -1
                  },
                  "modifiedBy": {
                    "id": 15071481,
                    "code": "cm.1",
                    "name": "cm.1",
                    "type": "TILL",
                    "adminType": "GENERAL",
                    "isActive": true,
                    "isOuEnabled": true,
                    "currencyId": 95,
                    "languageId": -1
                  },
                  "modifiedDate": "2021-07-30T11:25:21+05:30"
                },
                "fields": {
                  "gender": "MALE"
                },
                "identifiers": [
                  {
                    "type": "cuid",
                    "value": "cuid_91553000000"
                  }
                ],
                "commChannels": [
                  {
                    "type": "email",
                    "value": "tom.sawyer@capillarytech.com",
                    "primary": true,
                    "verified": true
                  }
                ],
                "source": "WECHAT",
                "userId": 409966468,
                "accountId": "WECHAT-CM",
                "autoUpdateTime": "2021-07-30T11:25:21+05:30",
                "identifiersAll": [
                  {
                    "type": "cuid",
                    "value": "cuid_91553000000"
                  }
                ]
              }
            ],
            "extendedFields": {
              "city": "city_6878387",
              "gender": "Male"
            }
          }
        ],
        "fleetCompany": {
          "externalId": "ex917471949194",
          "companyId": 71
        },
        "childRoleCode": "FC",
        "new": true
      },
      "extendedFields": {
        "city": "city_6878387",
        "gender": "Male"
      },
      "warnings": [
        {
          "code": 19223,
          "message": "Points processing failed"
        }
      ]
    },
    "childEntities": [
      {
        "id": 409966468,
        "profiles": [
          {
            "firstName": "Capillary",
            "lastName": "Customer",
            "attribution": {
              "createDate": "2021-07-30T11:25:21+05:30",
              "createdBy": {
                "id": 15071481,
                "code": "cm.1",
                "name": "cm.1",
                "type": "TILL",
                "adminType": "GENERAL",
                "isActive": true,
                "isOuEnabled": true,
                "currencyId": 95,
                "languageId": -1
              },
              "modifiedBy": {
                "id": 15071481,
                "code": "cm.1",
                "name": "cm.1",
                "type": "TILL",
                "adminType": "GENERAL",
                "isActive": true,
                "isOuEnabled": true,
                "currencyId": 95,
                "languageId": -1
              },
              "modifiedDate": "2021-07-30T11:25:21+05:30"
            },
            "fields": {
              "gender": "MALE"
            },
            "identifiers": [
              {
                "type": "cuid",
                "value": "cuid_91553015360"
              }
            ],
            "commChannels": [
              {
                "type": "email",
                "value": "tom.sawyer@capillarytech.com",
                "primary": true,
                "verified": true
              }
            ],
            "source": "WECHAT",
            "userId": 409966468,
            "accountId": "WECHAT-CM",
            "autoUpdateTime": "2021-07-30T11:25:21+05:30",
            "identifiersAll": [
              {
                "type": "cuid",
                "value": "cuid_91553015360"
              }
            ]
          }
        ],
        "loyaltyInfo": {
          "loyaltyType": "loyalty"
        },
        "associationDetails": {
          "hierarchyId": 21,
          "roleCode": "FC",
          "fleetCompany": {
            "externalId": "ex917471949194",
            "companyId": 71
          },
          "parentRoleId": 83,
          "new": true,
          "childCustomer": true
        },
        "extendedFields": {
          "city": "city_6878387",
          "gender": "Male"
        },
        "warnings": [
          {
            "code": 8056,
            "message": "Invalid mobile"
          }
        ]
      }
    ],
    "childCount": 2,
    "childSuccessCount": 2
  }
]