Create Customer
The CreateCustomer
API in OCS.io streamlines the process of adding new customer records by offering flexible customization options.
API Overview
Fields Required for Customer Creation
The following table lists and describes the fields required to create a customer through the CreateCustomer
API:
Field | Description |
---|---|
customerProfile |
Profile of the Customer to be used for creation. Customer Profile must be configured. |
externalId |
External ID of the Customer. |
customerSegment |
Segment of the Customer. Customer Segment must be configured. |
customName |
Custom Customer name. |
customAttributes |
Custom attributes, Key - Value (String) Map. |
state |
Initial State of the Customer. |
testCustomer |
Indicates whether Customer is a Test Customer. |
Detailed API documentation and endpoint specifics are available here. |
Request Validations
The following validations are performed when creating a customer:
-
If Customer Profile is provided in the request, it must be configured in the system.
-
If Customer Segment is provided in the request, it must be configured in the system.
-
State Reason must be configured in the system for given State.
-
If Pending State is provided in the request, it will be ignored and Customer will be created without Pending.
-
If Customer Profile is not provided in the request, attributes State and State Reason must be provided in the request.
-
If External ID is provided in the request, it must be unique and must not be already assigned to another Customer even in Deactivated State.
Create Customer Examples
1. Create Customer by Profile
Creating a customer in OCS.io is most straightforward when using a pre-configured customer profile. For more information on setting up customer profiles, see the configuration guide here.
The following example illustrates how to create a customer using this method:
{
"requestId": "{{$guid}}",
"externalId": "customer_external_id",
"customerProfile": "b2b"
}
2. Extend Customer Creation with Additional Attributes
To enhance a basic customer profile with additional attributes, such as a custom name, you can modify the initial request as shown below:
{
"requestId": "{{$guid}}",
"externalId": "customer_external_id",
"customerProfile": "b2b",
"customAttributes": {
"key1": "value 1",
"key2": "value 2"
},
"customName": "Demo Customer"
}
3. Create Customer by Specifying All Attributes
For complete customization, create a customer by providing all necessary attributes directly:
{
"requestId": "{{$guid}}",
"externalId": "customer_external_id",
"customerSegment": "b2b",
"customAttributes": {
"key1": "value 1",
"key2": "value 2"
},
"state" : {
"state": "ACTIVE",
"stateReason": "active"
},
"customName": "Demo Customer"
}