Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
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 <![CDATA[ACL rules.
URL format:
Name | Value |
---|---|
Default URL | /rest/v1 |
Authorization
In SimpeOneSimple, three types of 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
ParametersPOST /rest/v1/table/{tableName}
This method allows for inserting one record in the defined table. It does not support multiple records insertion.
Body parameter
NameParameter | DescriptionValue | |
---|---|---|
sysparmcolumn_name | columndisplay_value | Data retrieval operation method. Also, may return both types of values.
Default value: false. |
sysparm_fields | A comma-separated list of fields to return to the response. Value example: username,email. | |
sysparm_view | Render the response according to the specified UI view (overridden by sysparm_fields). Value example: SP. |
Body parameter
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Image Added
Section | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
READ operations
GET /rest/v1/table/{tableName}This method returns multiple record query from the specified table.
|
READ operations
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, 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: false. |
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. |
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Image Added
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
GET /rest/v1/table/{tableName}/{sys_id}
This method retrieves one record from the specified table.
Parameters
An encoded query string used to filter the results.
Value example: active=1.
Data retrieval operation method. Also, may return both types of values.
- true – returns field display values.
- false – returns database field 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: number,caller.
Render the response according to the specified UI view (overridden by sysparm_fields).
Value example: SP.
The maximum number of results returned by query.
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. |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
GET /rest/v1/table/itsm_change_request HTTP/1.1
Host: your-instance.example.ru
Authorization: Basic am91bi5kb4U6MTIzNDU2Nzg6
Cookie: SERVERID=srv-ocXctExSS6esqqmrg3ZkKA|Wqnmc |
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
{
"status": "OK",
"data": [
{
"sys_id": "156951264211094636",
"application_id": {
"value": "155931135900000002",
"link": "http://your-instance.example.ru/rest/v1/table/sys_application/155931135900000002"
},
"description": "",
"elevated_privilege": false,
"name": "impersonator",
"policy": "Protected",
"sys_created_at": "2019-09-30 00:00:00",
"sys_created_by": {
"value": "155931135900000001",
"link": "http://your-instance.example.ru/rest/v1/table/user/155931135900000001"
},
"sys_updated_at": "2019-12-17 15:32:15",
"sys_updated_by": {
"value": "155931135900000001",
"link": "http://your-instance.example.ru/rest/v1/table/user/155931135900000001"
}
}
]
} |
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 database field values.
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.
Body parameter
Parameter | Value |
---|---|
column_name | column_value |
Note |
---|
You need to use raw JSON type of Body instead of form-data. |
Image Added
Section | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
DELETE operations
DELETE /rest/v1/table/{tableName}/{sys_id}
Deletes the specified record with the request body from the specified table.
You can receive one of two possible responses:
- When the record was successfully deleted.
- When an error occurred.
Image Added
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<![CDATA[DELETE /rest/v1/table/dashboard/165476748114102626 HTTP/1.1 Host: your-instance.example.ru Content-Type: application/json Authorization: Basic am91bi5kb4U6MTIzNDU2Nzg6 Cookie: SERVERID=srv-ocXctExSS6esqqmrg3ZkKA|Wqnmc Content-Length: 23 { "method": "DELETE" }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 | ||||
---|---|---|---|---|
|