Customers

Customers are the people who create orders. A customer object must have an email and channel. All necessary information about customers is kept in customer objects. This includes information about communication permissions accepted by customers for example: email_allowed, sms_allowed etc.

Customer Creation

In order to create a customer record on the Omnitron product, any order from the marketplace must be fetched to Omnitron. When the relevant command runs in marketplace integrations, the order is created in Omnitron. At this stage, if the customer record has not been created before, customer information is created; if the customer record has been created before, the customer information is updated (works with the Upsert logic). Service methods are used in these creation and update processes.

In the integration document, the creation of the order and, accordingly, the creation of the customer will be discussed.

Potential Responses

  • 201 Created

  • 400 Bad Request

  • 404 Not Found

  • 405 Method Not Allowed

  • 406 Not Acceptable

GET Customers

Returns all objects in the Customers table paged.

Path: /api/v1/customers/

Filters

The available filters are as follows.

"filters": {
   "created_date": {
       "type": "DateFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte",
           "date"
       ]
   },
   "modified_date": {
       "type": "DateFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte",
           "date"
       ]
   },
   "attributes": {
       "type": "JsonMethodFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "channel": {
       "type": "ModelMultipleChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "email": {
       "type": "CharFilter",
       "lookup_types": [
           "exact",
           "startswith"
       ]
   },
   "first_name": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "last_name": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "phone_number": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "is_active": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "channel_code": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "erp_code": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "extra_field": {
       "type": "JsonMethodFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "email_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "sms_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "call_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "date_joined": {
       "type": "IsoDateTimeFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "gender": {
       "type": "ChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "user_type": {
       "type": "ChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "date_of_birth": {
       "type": "DateFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "id": {
       "type": "NumberFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte"
       ]
   },
   "pk": {
       "type": "NumberFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte"
       ]
   },
   "mapping": {
       "type": "RelatedFilter",
       "lookup_types": "See available filters for Integration Mappings"
   }
}

Request

Response

POST Create a Customer

Records new objects in the Customer table. The CustomerSerializer class defined at omnitron.customers.resources.serializers is used to validate the data.

Path: /api/v1/customers/

Body

Response

Response HTTP 400

GET Customer Detail

Returns the object specified with the primary key in the Customers table by serializing it with the CustomerSerializer class defined at omnitron.customers.resources.serializers.

Path: /api/v1/customers/{pk}/

Request

Successful Response

Failed Response

PATCH Update Customer

Updates the object of the relevant primary key in the Customer table with the provided parameters.

Path: /api/v1/customers/{pk}/

Response

PUT Update Customer

Allows to change the information of the relevant primary key in the Customer table. Mandatory parameters must be sent.

Path: /api/v1/customers/{pk}/

Successful Response

Failed Response

If we remove the email data from the body example, the following response will be returned.

Note: When we change the channel information and send a PUT or PATCH request in the body example, the following response will be returned.

Last updated

Was this helpful?