Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The
RESTTable API allows you to perform the create, read, update, and delete (CRUD) operations on the existing tables.
RequestsCRUD requests to
performthe
CRUD operations through the RESTTable API are executed according to the <![CDATA[ACL rules.
Table API URL format:
Name | Value |
---|---|
Default URL | /rest/v1/table/ |
Authorization
In Simple, three Two types of Table API request authorization are supported:
- No Auth – no authorization required for a request.
- 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.
Image Modified
CREATE operations
POST /rest/v1/table/{tableName}
Use this
Use the POST method to insert one record into the defined table. It does not support insertion of multiple records
insertion..
Example:
Code Block |
---|
<![CDATA[POST /rest/v1/table/{tableName} |
Body parameter
You can specify as many columns and their values as you need.Body parameter
Parameter | Value |
---|---|
column_namename | column_valuevalue |
You
need to use raw JSON type of Body instead of form-data.can use the following parameters with this method:
Image Removed
language | js |
---|---|
theme | Eclipse |
title | HTTP |
linenumbers | true |
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 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. Value example: number,caller. |
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 Added
Section | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
READ operations
GET /rest/v1/table/{tableName}This method returns multiple record queryRead operations in SimpleOne are limited to the GET method. Depending on whether you need to retrieve a single record or some of them, follow the examples below:
To retrieve a single record from the specified table
.:
Code Block |
---|
<![CDATA[GET |
/rest/v1/table/{tableName}/{sys_id} |
To retrieve multiple record query from the specified table
.:
Parameters
Code Block |
---|
<![CDATA[GET /rest/v1/table/{tableName} |
You can use the following parameters with this method:
Parameter | Description |
---|---|
Name | Description |
sysparm_query | An encoded query string used to filter the results. Value example: active=1. |
sysparm_display_value | Data retrieval An operation method . Also, it for data retrieval. It may return both types of values.
Default value: false0. |
sysparm_exclude_reference_link | Flag that indicates A flag indicating whether to exclude Table API links for (/rest/v1/table/ ) for reference fields.Valid values:
Default value: 0 0. |
sysparm_fields | A comma-separated list of fields to return to the response. Value example: number,caller. |
sysparm_view | Render the response according to the specified UI view (The response contains the fields of the form view defined by this parameter. Note that it can be overridden by sysparm_fields). Value exampleDefault value: SP Default. |
sysparm_limit | The maximum number of results returned by query. Default value: 20 (for GET-queries). |
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 will include records from 21 to 60. Default value: 1. |
Note |
---|
Use raw JSON type of Body instead of form-data. |
Image Modified
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UPDATE operations
There are two methods available for the UPDATE operations:
PUT creates records or updates records with
|
UPDATE operations
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 |
Note |
---|
Use raw JSON type of Body instead of form-data. |
You can 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. Value example: number,caller. |
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. |
PUT
Use it to update records in the specified table using the values defined in the request body.
Example:
Code Block | ||
---|---|---|
| ||
<![CDATA[PUT |
In other words, in PATCH, nested objects contain a set of instructions that describe how records on the origin server should be updated to create new versions. And PUT contains new versions of records.
PUT/rest/v1/table/{tableName}/{sys_id} |
PATCH
Use it to partially update records. This method updates
the specified record witha specified record with the request body in the specified table.
Example:
Code Block |
---|
<![CDATA[PATCH /rest/v1/table/{tableName}/ |
This method updates the specified record with the request body in the specified table.
{sys_id} |
Example:
Body parameter
Image Modified
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
DELETE operations
DELETE
|
DELETE operations
Use this method to delete a specified record with the request body from the specified table.
Example:
Code Block |
---|
<![CDATA[DELETE /rest/v1/table/{tableName}/{sys_id} |
There are two possible responses:
- When a record was successfully deleted.
- When an error occurred.
Example:
Image Modified
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<![CDATA[DELETE /rest/v1/table/sys_filter/166039918402151705 HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu |
Success response
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<![CDATA[{
"status": "OK",
"data": {
"description": "Records successfully deleted."
} |
Error response
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<![CDATA[{
"status": "ERROR",
"error_type": "SERVER",
"errors": [
{
"message": "You have no access to delete this records."
}
]
}
|
Table of Contents | ||||
---|---|---|---|---|
|