Home / Documentation / REST APIs / Models API
Models API
The Models API is a set of endpoints to create, retrieve, update, and delete entity models.
- Get all entity models
- Get an entity model
- Create an entity model
- Update an entity model
- Delete an entity model
Get all entity models
Returns all entity models from the .zentity-models index.
GET _zentity/models
HTTP Headers
| Header | Value |
|---|---|
Content-Type |
application/json |
URL Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
pretty |
Boolean | false |
No | Indents the JSON response data. |
Get an entity model
Returns the entity model for a given entity_type from the .zentity-models
index.
GET _zentity/models/{entity_type}
HTTP Headers
| Header | Value |
|---|---|
Content-Type |
application/json |
URL Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
entity_type |
String | Yes | Entity type. | |
pretty |
Boolean | false |
No | Indents the JSON response data. |
Create an entity model
Creates an entity model for a given entity_type and puts it in the
.zentity-models index. Returns an error if an entity model already exists for
that entity_type.
For more details about the contents of the payload, read the entity model specification.
POST _zentity/models/{entity_type}
{
"attributes": {
ATTRIBUTE_NAME: {
"type": ATTRIBUTE_TYPE,
"params": {
PARAM_NAME: PARAM_VALUE,
...
}
},
...
},
"resolvers": {
RESOLVER_NAME: {
"attributes": [
ATTRIBUTE_NAME,
...
]
}
...
},
"matchers": {
MATCHER_NAME: {
"clause": MATCHER_CLAUSE,
"params": {
PARAM_NAME: PARAM_VALUE,
...
}
},
...
},
"indices": {
INDEX_NAME: {
"fields": {
INDEX_FIELD_NAME: {
"attribute": ATTRIBUTE_NAME,
"matcher": MATCHER_NAME
},
...
}
},
...
}
}
HTTP Headers
| Header | Value |
|---|---|
Content-Type |
application/json |
URL Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
entity_type |
String | Yes | Entity type. | |
pretty |
Boolean | false |
No | Indents the JSON response data. |
Update an entity model
Updates an entity model for a given entity_type.
Creates the entity model if it does not already exist.
For more details about the contents of the payload, read the entity model specification.
PUT _zentity/models/{entity_type}
{
"attributes": {
ATTRIBUTE_NAME: {
"type": ATTRIBUTE_TYPE,
"params": {
PARAM_NAME: PARAM_VALUE,
...
}
},
...
},
"resolvers": {
RESOLVER_NAME: {
"attributes": [
ATTRIBUTE_NAME,
...
]
}
...
},
"matchers": {
MATCHER_NAME: {
"clause": MATCHER_CLAUSE,
"params": {
PARAM_NAME: PARAM_VALUE,
...
}
},
...
},
"indices": {
INDEX_NAME: {
"fields": {
INDEX_FIELD_NAME: {
"attribute": ATTRIBUTE_NAME,
"matcher": MATCHER_NAME
},
...
}
},
...
}
}
HTTP Headers
| Header | Value |
|---|---|
Content-Type |
application/json |
URL Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
entity_type |
String | Yes | Entity type. | |
pretty |
Boolean | false |
No | Indents the JSON response data. |
Delete an entity model
Deletes the entity model for a given entity_type from the .zentity-models
index.
DELETE _zentity/models/{entity_type}
URL Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
entity_type |
String | Yes | Entity type. | |
pretty |
Boolean | false |
No | Indents the JSON response data. |
Continue Reading
| ‹ | Setup API | Bulk Models API | › |
|---|---|---|---|