Skip to content

CRUD API

Vasat models can be quickly exposed via basic CRUD endpoints

Create

POST /api/ClassName

A post creates a new object with a auto generated ID Request

json
{
    "name":"My Article",
    "category":"SciFi"
}

Update

PUT /api/ClassName/<ID>

A put updates an existing record

json
{
    "name":"My Article",
    "category":"SciFi"
}

Unlike creates and upserts an update can send a partial update.

Example will only update the name attribute.

Request

json
{
    "name":"My Article",
}

Read

GET /api/ClassName/<ID>

Will read a single object when ID is known Response

json
{
    "status": 200,
    "message": "OK",
    "payload":
    {
        "id": "1234",
        "item":
        {
			"name":"My Article",
			"category":"SciFi"
        },
        "displayName": "My Article",
        "dateMade": 1691581072288,
        "dateUpdated": 1724207582891,
        "paths": ["/public"],
        "acl": ["read","search"]
    }
}

There are a number of metaData columns along with the record itself

  • id: The identifier
  • displayName: A string value that describes the items name
  • dateMade: date record was made
  • dateUpdated: date record was updated
  • paths: the access control paths this object it located in (this can be suppressed)
  • acl: the acl permissions for the current session rot this object

Delete

DELETE /api/ClassName/<ID>

Performs a hard deleted of the object.

Upsert

POST /api/ClassName/<ID>

An upsert is a combination of the Create (insert) and update functions

The URL of the the upsert specified the ID. If the id does not exist the action performed will be a Create. Otherwise it will be an update.

This method allows the caller to specify the ID of the object

Request

json
{
    "name":"My Article",
    "category":"SciFi"
}

Write request Responses

Update/Create and Upsert all return the same response the. The identifier on teh object (Mostly used for a Create request). As well as a hash when the object is VersionControlled

Response:

json
{
    "status":200,
    "message":"OK",
    "payload":{
        "id":"1234-1235-12345-34345",
        "hash":"xxxxxxxxxxxx"
    }
}