Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The Table API allows you to perform the create, read, update, and delete (CRUD) operations on the existing tables.
The CRUD requests to the Table API are executed according to the ACL rules.
Table API URL format:
Name | Value |
---|---|
Default URL | /rest/v1/table/ |
Authorization
Two types of Table API request authorization are supported:
- Basic Auth – authentication involves sending a verified username and password with the request.
- Bearer Token – authentication with an access key. The token is a text string, included in the request header.
CREATE operation
Use the POST method to insert one record into the defined table. It does not support insertion of multiple records.
Example:
Code Block |
---|
POST /rest/v1/table/{tableName} |
Body parameter
You can specify as many columns and their values as you need.
Parameter | Value |
---|---|
column_name | column_value |
Use the following parameters with this method:
Parameter | Description | ||
---|---|---|---|
sysparm_display_value | An operation method for data retrieval. It may return two types of values:
Default value: 0. | ||
sysparm_exclude_reference_link | A flag indicating whether to exclude the Table API links (/rest/v1/table/ ) for reference fields.Valid values:
Default value: 0. | ||
sysparm_fields | A comma-separated list of fields to return to the response. The parameter supports the usage of dot-walking.
Value example: number,caller.phone | ||
sysparm_view | The response contains the fields of the form view defined by this parameter. Note that it can be overridden by sysparm_fields. Default value: Default. |
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Example:
Image Removed
From the set of columns of the view specified in sysparm_view, only those specified in sysparm_fields are returned. If the fields specified in sysparm_fields are not present in the selected view, the view will not be returned.
|
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Example:
Image Added
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||
Section | ||||||||||||||||||||||||
|
READ operation
Read operations in SimpleOne are limited to the GET method.
- To retrieve a single record from the specified table:
Code Block |
---|
GET /rest/v1/table/{tableName}/{sys_id} |
- To retrieve a multiple record query from the specified table:
Code Block |
---|
GET /rest/v1/table/{tableName} |
Use the following parameters with this method.
Parameter | Description | ||
---|---|---|---|
sysparm_query | An encoded query string used to filter the results. The parameter supports the usage of dot-walking. Value example: active=1. To create a complex query, use the system name of the operators and the condition string. | ||
sysparm_display_value | An | sysparm_display_value | An operation method for data retrieval. It may return both types of values.
Default value: 0. |
sysparm_exclude_reference_link | A flag indicating whether to exclude Table API links (/rest/v1/table/) for reference fields. Valid values:
Default value: 0. | ||
sysparm_fields | A comma-separated list of fields to return to the response. The parameter supports the usage of dot-walking. Value example: number,caller.phone | ||
sysparm_view | The response contains the fields of the form view defined by this parameter. Note that it can be overridden by sysparm_fields. Default value: Default. From the set of columns of the view specified in sysparm_view, only those specified in sysparm_fields are returned. If the fields specified in sysparm_fields are not present in the selected view, the view will not be returned.
| ||
sysparm_limit | The maximum number of results returned by query. | sysparm_limit | The maximum number of results returned by query. Default value: 20. |
sysparm_page | Define the page number to start reading from. For example, if sysparm_limit is set to 40, and you set sysparm_page to 2, the response includes records from 21 to 60. Default value: 1. |
Note |
---|
Use raw JSON type of Body instead of form-data. |
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UPDATE operation
There are two methods available for the UPDATE operations: PUT and PATCH. PUT contains new versions of records. Whereas in PATCH, nested objects contain a set of instructions that describe how records on the origin server should be updated to create new versions.
Body parameter
You can specify as many columns and their values as you need.
Parameter | Value |
---|---|
column_name | column_value |
Use the following parameters for the PUT and PATCH methods:
Parameter | Description |
---|---|
sysparm_display_value | An operation method for data retrieval. It may return both types of values.
Default value: 0. |
sysparm_exclude_reference_link | A flag indicating whether to exclude Table API links (/rest/v1/table/) for reference fields. Valid values:
Default value: 0. |
sysparm_fields | A comma-separated list of fields to return to the response. The parameter supports the usage of dot-walking. Value exampleValue example: number,caller.phone |
sysparm_view | The response contains the fields of the form view defined by this parameter. Note that it can be overridden by sysparm_fields. Default value: Default. |
Note |
---|
Use raw JSON type of Body instead of form-data. |
PUT
Use it to update records in the specified table using the values defined in the request body.
Example:
Code Block | ||
---|---|---|
| ||
PUT /rest/v1/table/{tableName}/{sys_id} |
PATCH
From the set of columns of the view specified in sysparm_view, only those specified in sysparm_fields are returned. If the fields specified in sysparm_fields are not present in the selected view, the view will not be returned.
|
Note |
---|
Use raw JSON type of Body instead of form-data. |
PUT
Use it to update records in the specified table using the values defined in the request body. Use it to partially update records. This method updates a specific record with the request body in the specified table.
Example:
Code Block | ||
---|---|---|
| ||
PUTPATCH /rest/v1/table/{tableName}/{sys_id} |
Image Modified
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PATCH
Use it to partially update records. This method updates a specific record with the request body in the specified table.
Example:
Code Block |
---|
PATCH /rest/v1/table/{tableName}/{sys_id} |
Section | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
DELETE operation
Use this method to delete a specific record with the request body from the specified table.
Example:
Code Block |
---|
DELETE /rest/v1/table/{tableName}/{sys_id} |
There are two possible responses:
- When a record was successfully deleted.
- When an error occurred.
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DELETE /rest/v1/table/sys_filter/166039918402151705 HTTP/1.1 Host: sandbox-01.dev.simpleone.ru Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "status": "OK", "data": { "description": "Records successfully deleted." } |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "status": "ERROR", "error_type": "SERVER", "errors": [ { "message": "You have no access to delete this records." } ] } |
Table of Contents | ||||
---|---|---|---|---|
|