The REST API allows you to perform the create, read, update, and delete (CRUD) operations on existing tables. Requests to perform the CRUD operations through the REST API are executed according to the <![CDATA[ACL rules.
URL format:
Name | Value |
---|---|
Default URL | /rest/v1 |
In Simple, three types of authorization are supported:
POST /rest/v1/table/{tableName}
Use this method to insert one record into the defined table. It does not support multiple records insertion.
Body parameter
Parameter | Value |
---|---|
column_name | column_value |
You need to use raw JSON type of Body instead of form-data. |
|
GET /rest/v1/table/{tableName}This method returns multiple record query from the specified table.
GET /rest/v1/table/{tableName}/{sys_id}
This method retrieves one record from the specified table.
Parameters
Name | Description |
---|---|
sysparm_query | An encoded query string used to filter the results. Value example: active=1. |
sysparm_display_value | Data retrieval operation method. Also, it may return both types of values.
Default value: false. |
sysparm_exclude_reference_link | Flag that indicates whether to exclude Table API links 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 | Render the response according to the specified UI view (overridden by sysparm_fields). Value example: SP. |
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. |
Use raw JSON type of Body instead of form-data. |
|
There are two methods available for the UPDATE operations:
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.
Body parameter
Parameter | Value |
---|---|
column_name | column_value |
Use raw JSON type of Body instead of form-data. |
|
DELETE /rest/v1/table/{tableName}/{sys_id}
Use this method to delete the specified record with the request body from the specified table.
There are two possible responses:
<![CDATA[DELETE /rest/v1/table/sys_filter/166039918402151705 HTTP/1.1 Host: sandbox-01.dev.simpleone.ru Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu |
Success response
<![CDATA[{ "status": "OK", "data": { "description": "Records successfully deleted." } |
Error response
<![CDATA[{ "status": "ERROR", "error_type": "SERVER", "errors": [ { "message": "You have no access to delete this records." } ] } |