Tutorial - Using the API to add master data and configuration models.
This guide will show you how to create new master data in Elfsquad (for example: from ERP), and use it to create configuration models using only the API. Ofcourse all data created here can be viewed, changed and deleted through both the API and the interface (EMS). For this purpose the elfsquad data api will be used. For more information, refer to the provided documentation. https://docs.elfsquad.io/docs/apis/data-api
1. Creating master data: features
Before you can start building your model, you will first need the building blocks of Elfsquad: features. In order to continue it is highly recommended to read our basic documentation about features. https://support.elfsquad.io/hc/en-us/articles/360035473554-What-are-Features. For some more information: https://support.elfsquad.io/hc/en-us/articles/5266441178130-Create-or-update-Features-via-Data-API.
The data API offers two separate endpoints for creating new features: one for adding a single feature and another for adding multiple features. We strongly advice using the latter over sending multiple requests to the single feature endpoint. To create multiple features, the following request must be sent:
POST: https://api.elfsquad.io/data/1/Features/Default.BulkInsert
The body should have the following format:
{
"entities": [
{
"id": "32915340-0924-409b-a938-f7024b3d883c",
"name": "Product 1",
"articleCode": "AB1",
"type": "Feature",
"salesPrice": 75,
"minValue": 0,
"maxValue": 0,
"stepValue": 0,
"packingUnit": 0,
"reference": "ERP-REF-01",
"customField1": "string",
"customField2": "string",
"customField3": "string",
"customField4": "string",
"customField5": "string"
},
{
"id": "32915340-0924-409b-a938-f7024b3d883d",
"name": "Product 2",
"articleCode": "AB2",
"type": "Feature",
"salesPrice": 100,
"minValue": 0,
"maxValue": 0,
"stepValue": 0,
"packingUnit": 0,
"reference": "ERP-REF-02",
"customField1": "string",
"customField2": "string",
"customField3": "string",
"customField4": "string",
"customField5": "string"
}
]
}
Specifying ids in this example is crucial for the next step. While Elfsquad can generate them if omitted, knowing the ids beforehand avoids having to fetch them later on.
Fore more information about the request and response bodies, refer to the provided documentation.
Single feature: https://docs.elfsquad.io/docs/spec/data/features-feature-create-feature
Multiple features: https://docs.elfsquad.io/docs/spec/data/features-bulk-insert