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.
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
In SimpeOne, three Two types of Table API request authorization are supported:
No Auth – request does not require authorization.- 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 Removed
Image Added
CREATE operations
POST /rest/v1/table/{tableName}
This method allows for inserting one record in
Use the POST method to insert one record into the defined table. It does not support insertion of multiple records
insertion.Parameters
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 |
You can use the following parameters with this method:
Parameter | Description | |||
---|---|---|---|---|
sysparm_display_value | An operation method for data retrieval. It may return both types of values.
| |||
Name | Description | |||
sysparm_display_value |
Default value: | false0. | ||
sysparm_exclude_reference_link | Flag that indicatesA flag indicating whether to exclude the Table API links (/rest/v1/table/ ) for reference fields.Valid values: | true – exclude
| false – include
Default value: | false0. |
sysparm_fields | A comma-separated list of fields to return to the response. Value example: | usernamenumber, | emailcaller. | |
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: | SPDefault. |
Body parameter
Notenote |
---|
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 records for thespecified table.
GET
|
This method retrieves one record from the specified table.
|
READ operations
Read 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 |
---|
GET /rest/v1/table/{tableName}/{sys_id} |
To retrieve multiple record query from the specified table:
Code Block |
---|
GET /rest/v1/table/{tableName} |
You can use the following parameters with this method:
Parameter | Description |
---|---|
sysparm_query | An encoded query string used to filter the results. Value example: active=1. |
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. |
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 will include records from 21 to 60. Default value: 1. |
Note |
---|
Use raw JSON type of Body instead of form-data. |
Image Added
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Parameters
An encoded query string used to filter the results.
Value example: last_nameENDSWITHov.
Data retrieval operation method. Also, may return both types of values.
- true – returns field display values.
- false – returns actual values.
Default value: false.
Valid values:
- true – exclude Table API links for reference fields.
- false – include Table API links for reference fields.
Default value: false.
A comma-separated list of fields to return to the response.
Value example: username,email.
Render the response according to the specified UI view (overridden by sysparm_fields).
Value example: SP.
The maximum number of results returned per page.
Default value: 20 (for GET-queries).
Page number to offset records.
Default value: 1.
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UPDATE operations
There are two methods available for UPDATE operations:
- PUT creates records or updates records with values defined in the request body.
- PATCH is used to partially update records.
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}
This method updates the specified record with the request body in the specified table.
PATCH /rest/v1/table/{tableName}/{sys_id}
This method updates the specified record with the request body in the specified table.
Parameters
Data retrieval operation method. Also, may return both types of values.
- true – returns field display values.
- false – returns actual values.
Default value: false.
Valid values:
- true– exclude Table API links for reference fields.
- false – include Table API links for reference fields.
Default value: false.
A comma-separated list of fields to return to the response.
Value example: username,email.
Render the response according to the specified UI view (overridden by sysparm_fields).
Value example: SP.
|
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 | ||
---|---|---|
| ||
PUT /rest/v1/table/{tableName}/{sys_id} |
PATCH
Use it to partially update records. This method updates a specified record with the request body in the specified table.
Example:
Code Block |
---|
PATCH /rest/v1/table/{tableName}/{sys_id} |
Example:
Image Added
Body parameter
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 |
---|
DELETE /rest/v1/table/{tableName}/{sys_id} |
Deletes the specified record with the request body from the specified table.
You can receive one of There are two possible responses:
- When the a record was successfully deleted.
- When an error occurred.
Example:
Image Added
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DELETE /rest/v1/table/dashboardsys_filter/165476748114102626166039918402151705 HTTP/1.1 Host: yoursandbox-instance01.dev.examplesimpleone.ru Content-Type: application/json Authorization: Basic am91bi5kb4U6MTIzNDU2Nzg6 Cookie: SERVERID=srv-ocXctExSS6esqqmrg3ZkKA|Wqnmc Content-Length: 23 { "method": "DELETE" }Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu |
Success response
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "status": "OK", "data": { "description": "Records successfully deleted." } |
Error response
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "status": "ERROR", "error_type": "SERVER", "errors": [ { "message": "You have no access to delete this records." } ] } |
Table of Contents | ||||
---|---|---|---|---|
|