Skip to main content Link Menu Expand (external link) Document Search Copy Copied

CRUD Operations

In Wisk, all entities have a standarized endpoint to create/edit new objects of the kind.

The standard is the following:

For creation: 
POST /{entity_type}/id/0

For editing: 
POST /{entity_type}/id/{entity_id}

For example, for items in production it would be

POST https://api.wisk.ai/items/id/0

Inside the POST body, there will be always an array of operations. Each operation is an atomic modification to the entity. This way, we can always have an historical timeline of which changes were made to each object.

Operations always have the same structure: a type and a value, where the value can be either a primitive or a complex object.

Example to create a distributor:

Url:

POST /distributors/id/0

POST Body:
{
  "operations": [
    {
      "type": "title",
      "value": "New distributor"
    }
  ]
}

Example to modify a distributor to add contact details:

Url:

POST /distributors/id/67567862

POST Body:
{
  "operations": [
    {
      "type": "add_contact",
      "value": {
	      "name": "Chip",
	      "email": "chip@wisk.ai",
	      "phone": "123445566"
      }
    }
  ]
}