Each database object’s API has a base path followed by a CRUD operation, a query to search for the record (this is typically the record’s unique identifier, and the fields you are querying or modifying.
DataTable calls follow a standard structure. For example, the following call updates the title of the asset with a unique identifier of ZZ13UH3.
POST or GET
/API/DataTable/v2.2/Documents.Image.default:Update?CoreField.Identifier=ZZ13UH3&CoreField.Title:=Tower Bridge
Let’s break down the structure of this call.
Template
/API/DataTable/[version]/[Object.Type.Subtype]/:[CRUD operation]?[Identifying field API name][operator][Identifying field value]&[Field to change][Operator][New field value]
Example call
/API/DataTable/v2.2/Documents.Image.default:Update?Corefield.Identifier=ZZ13UH3&CoreField.Title:=Tower Bridge
- DataTable: The API you are using.
- v2.2: The version. The DataTable API has two versions.
- Version 2.1 is used for contacts, keywords, and permissions.
- Version 2.2 is used for assets.
- Documents.Image.default: These labels correspond to the database Object, Type, and Subtype, respectively. In this example, the database object is Documents (which are assets), the Asset Type is Image, and the Asset Subtype is the default image subtype, which is “Standard Image.” To find the syntax for a specific subtype, use the List all database objects API, or go to Administration > Archives > Manage Asset Types in the Orange Logic interface.
- Update: The CRUD action.
- Corefield.Identifier: This field is used to find the asset that you want to view, update or delete. This example uses the unique identifier. You can get the full list of fields available for any object type or subtype using the List all metadata fields call.
- =: This operator specifies what the call does to the field. In this case, the call is finding an asset with a unique identifier of ZZ13UH3. There are separate READ operators and UPDATE operators.
- ZZ13UH3: The value in the field used to find the asset. In this example, ZZ13UH3 is the asset’s unique identifier.
- &: This connector allows you to add multiple fields and operations to the call.
- CoreField.Title: The API name of the field you want to update. In this example, this is the title field’s API name.
- :=: This operator specifies what the call does to the field. In this case, the
:=
operator replaces the value in a single-value field. Therefore, the call is updating the asset’s title to “Tower Bridge.” The READ and UPDATE actions have unique operators. - Tower Bridge: Target value for the field the call updates. In this example, the asset’s title will be updated to “Tower Bridge.”