Thing Models represent a blueprint for a class of things within a particular organization. Rather than repeatedly configuring properties for individual things that are of the same type, this configuration can be done just once for a single thing model and reused over and over. Separate, associated APIs are called to add properties to a given thing model.

Create

New Thing Models can be created in an Organization by a User with Creator Role permissions. The API JSON POST must contain the desired Thing Model name and description in the body of the request. The API JSON response contains the Thing Model’s unique identity.

RequestResponse
POST https://<moab url>/api/v1/thingmodelSuccess
{
“Name”:”<thing model name>”,
“Description”:”<thing model description>”,
“Version”:”<thing model version>”
}
{
“id”:<thing model id>,
“status”: “success”,
“message”: “thing model created”
}
Failure
{
“id”:”0″,
“status”:”error”,
“message”:”thing model creation failed”
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Unauthorized”,
“status”: 401,
“traceId”: “|…”
}
Curl
curl -L -X POST ‘https://<moab url>/api/v1/ThingModel’ \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: Bearer <identity>.<security token>’ \
–data-raw ‘{
“name”: “<name>”,
“description”: “<description>”,
“version”: <version number>
}’

Read All

To retrieve a list of all Thing Models in a particular Organization, a User from that Organization with Reader Role permissions makes an API GET request with no parameters. The API JSON response contains repeating Thing Model identities, names, descriptions, and versions.

RequestResponse
GET https://<moab url>/api/v1/thingmodelSuccess
[
{
“id”: <thing model id>,
“name”: “<thing model name>”,
“description”: “<thing model description>”,
“version”: “<thing model version>”
},
{
“id”: <thing model id>,
“name”: “<thing model name>”,
“description”: “<thing model description>”,
“version”: “<thing model version>”
}
]
Failure
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Not Found”,
“status”: 404,
“traceId”: “|…”
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Unauthorized”,
“status”: 401,
“traceId”: “|…”
}
Curl
curl -L -X GET ‘https://<moab url>/api/v1/ThingModel’ \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: Bearer <identity>.<security token>’

Read One

To retrieve a Thing Model in a particular Organization, a User from that Organization with Reader Role permissions makes an API GET request with the Thing Model identity parameter at the end of the URL. The API JSON response contains the Thing Model identity, name, description, and version.

RequestResponse
GET https://<moab url>/api/v1/thingmodel/<id>Success
{
“id”: <thing model id>,
“name”: “<thing model name>”,
“description”: “<thing model description>”,
“version”: “<thing model version>”
}
Failures
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Not Found”,
“status”: 404,
“traceId”: “|…”
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “One or more validation errors occurred.”,
“status”: 400,
“traceId”: “|…”,
“errors”: { [ … ] }
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Unauthorized”,
“status”: 401,
“traceId”: “|…”
}
Curl
curl -L -X GET ‘https://<moab url>/api/v1/ThingModel/<id>’ \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: Bearer <identity>.<security token>’

Delete

To delete a Thing Model in a particular Organization, a User from that Organization with Creator or Contributor Role permissions makes an API DELETE request with the Thing Model identity parameter at the end of the URL. The API JSON response contains the Thing Model identity.

RequestResponse
DELETE https://<moab url>/api/v1/thingmodel/<id>Success
{
“id”: <thing model id>,
“status”: “success”,
“message”: “thing model deleted”
}
Failures
{
“id”: <thing model id>,
“status”: “error”,
“message”: “thing model deletion failed”
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “One or more validation errors occurred.”,
“status”: 400,
“traceId”: “|…”,
“errors”: { [ … ] }
}
{
“type”: “https://tools.ietf.org/html/rfc…”,
“title”: “Unauthorized”,
“status”: 401,
“traceId”: “|…”
}
Curl
curl -L -X DELETE ‘https://<moab url>/api/v1/ThingModel/<id>’ \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: Bearer <identity>.<security token>’