[POST] Custom entities

Modified on Wed, 11 Mar at 12:27 PM

Create Custom Entities


This operation allows you to create a new item within a specific Custom Entity table.


It follows REST architecture principles and complies with the OData v4.01 standard


[POST] Custom Entities Endpoint


https://api2.saleslayer.com/rest/Catalog/CustomEntity('{customEntityDenominator}')


Making a request


  • Use the HTTP method: POST.
  • Include the API key in the request headers for authentication.
  • The body must be sent in JSON format.
  • You must include attributes using their identifiers (not database names).
  • The xxxx_ref field is mandatory.


Request body example 1:


{
  "sales_ref": "SM001",
  "sales_title": {
    "en": "Main Supplier",
    "es": "Proveedor Principal"
  },
  "sales_description": "Distributor for EMEA region",
  "sales_status": "D",
  "sales_logo": "logo_emea.png",
  "sales_productrelated": "ref-004"
}


The values of a related item field are not validated. It can be any string. It contains the references of the items separated by commas with no spaces.


The prefix (sales) depends on the technical name of the defined entity.


Fields such as xxxx_stat, xxxx_title, or xxxx_description must already exist.


Response


201 Created


If the item was successfully created.


Example of response headers:


content-length: 0
date: Thu, 28 May 2025 10:06:02 GMT
location: http://api2-rest-release-queen.kp.saleslayer.com/CustomEntities('Sales')/Item(3)


Please note that the response returns the Item, which is useful for future reference.


400 Bad Request


  • Missing mandatory field: "Attribute xxxx_ref is mandatory"
  • Unrecognized field: "Field xxxx_size is not valid"


401 Unauthorized


Missing or invalid API key.


403 Forbidden


User does not have permission to create variants.


404 Not Found


The custom entity does not exist or was deleted


412 Precondition Failed


System is not in a valid state to perform the operation.


500 Internal Server Error


Unexpected system failure


Limitations


  • Only one element can be created per request.
  • Batch creation is not currently supported.
  • Field names vary by entity.
  • The field suffix depends on the entity name (xxxx_).
  • Duplicate field names or fields that do not exist in the defined structure are not allowed.
  • Internal fields such as xxxx_id, xxxx_modify, xxxx_creation, etc. cannot be included.
  • Images must be referenced by name and must already exist.
  • All changes are automatically recorded in the activity table (_activity_).


Multi-language fields support


If your account has multilingual fields configured, you can include values in multiple languages per attribute.


{
  "brands_ref": "NIKE_001",
  "brands_title": {
    "en": "Nike",
    "es": "Nike"
  },
  "brands_description": {
    "en": "Global sport brand",
    "es": "Marca deportiva global"
  },
  "brands_stat": "V"
}


Multilingual field conditions


You can send multilingual values for fields only if:


  • The field must be defined as multilingual.
  • The language must be supported by your account.


Common errors:


  • Unsupported language → 400 - Invalid language code
  • Non-multilingual field → 400 - Attribute does not support multi-language

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article