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:

NameValue
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.

Image Modified


CREATE

operations

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.

ParameterValue
column_name column_value 

You can use Use the following parameters with this method:

ParameterDescription
sysparm_display_value

An operation method for data retrieval. It may return both two types of values.:

  • 1 – returns field display values.
  • 0 – returns database field values.

Default value: 0.

sysparm_exclude_reference_linkA flag indicating whether to exclude the Table API links (/rest/v1/table/) for reference fields.

Valid values:

  • 1 – exclude Table API links for reference fields.
  • 0 – include Table API links for reference fields.

Default value: 0.

sysparm_fields

A comma-separated list of fields to return to the response. The parameter supports the usage of dot-walking.

Note

Dot-walking does not work for the Schedule (sys_schedule) and Indication (sys_indication) tables as the system does not create records immediately after the method call.

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.

Info

If the parameter is not set, the response to the request returns the values of all columns of the table.



Note

You need to use raw JSON type of Body instead of form-data.


Example:

Image Modified

Section


Code Block
languagejs
themeEclipse
titleHTTP
linenumberstrue
POST /rest/v1/table/task HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu
Content-Type: application/json
Content-Length: 43

{
    "subject": "Task created by REST"
}


Code Block
languagejs
themeConfluence
titleResponse
linenumberstrue
collapsetrue
{
  "status": "OK",
  "data": [
    {
      "sys_id": "166031411802010329",
      "state": "7",
      "priority": null,
      "urgency": null,
      "impact": null,
      "assigned_user": null,
      "assignment_group": null,
      "wf_executing_activity": null,
      "closed_by": null,
      "followers_list": null,
      "parent_id": null,
      "opened_by": null,
      "caller": {
        "value": "155931135900000001",
        "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
      },
      "contact": null,
      "service": null,
      "screenshot": null,
      "short_description": null,
      "work_notes": null,
      "active": true,
      "closed_at": null,
      "sla_due": null,
      "sys_updated_at": "2022-08-12 14:21:58",
      "sys_created_at": "2022-08-12 14:21:58",
      "description": null,
      "number": "TSK0000006",
      "subject": "Task created by REST",
      "additional_comments": null,
      "comments": null,
      "opened_at": "2022-08-12 14:21:58",
      "due_date": null,
      "attention_required": false,
      "company": null,
      "approval_state": "not_requested",
      "sys_db_table_id": "155931135900000083",
      "display_name": "TSK0000006 Task created by REST",
      "sys_updated_by": {
        "value": "155931135900000001",
        "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
      },
      "sys_created_by": {
        "value": "155931135900000001",
        "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
      }
    }
  ]
}



READ

operations

operation


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 a multiple record query from the specified table:
Code Block
GET /rest/v1/table/{tableName}


You can use Use the following parameters with this method:.

ParameterDescription
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 operation method for data retrieval. It may return both types of values.

  • 1 – returns field display values.
  • 0 – returns database field values.

Default value: 0.

sysparm_exclude_reference_linkA flag indicating whether to exclude Table API links (/rest/v1/table/) for reference fields.

Valid values:

  • 1 – exclude Table API links for reference fields.
  • 0 – include Table API links for reference fields.

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.

sysparm_limit

The maximum number of results returned by query.

Default value: 20.

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.

Info

If the parameter is not set, the response to the request returns the values of all columns of the table.


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,

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 includes records from 21 to 60.

Default value: 1.


Note

Use raw JSON type of Body instead of form-data.

Image RemovedImage Added

Section


Code Block
languagejs
themeEclipse
titleHTTP
linenumberstrue
GET /rest/v1/table/task?sysparm_query=active=1&sysparm_fields=number,caller&sysparm_limit=1&sysparm_exclude_reference_link=true HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu


Code Block
languagejs
themeConfluence
titleResponse
linenumberstrue
collapsetrue
{
    "status": "OK",
    "data": [
        {
            "number": "TSK0000006",
            "caller": 155931135900000001
        }
    ]
}


UPDATE

operations

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.

ParameterValue
column_namecolumn_value
note

Use

raw JSON type of Body instead of form-data.

You can use the following parameters for the PUT and PATCH methods:

ParameterDescription
sysparm_display_value

An operation method for data retrieval. It may return both types of values.

  • 1 – returns field display values.
  • 0 – returns database field values.

Default value: 0.

sysparm_exclude_reference_linkA flag indicating whether to exclude Table API links (/rest/v1/table/) for reference fields.

Valid values:

  • 1 – exclude Table API links for reference fields.
  • 0 – include Table API links for reference fields.

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.

PUT

Use it to update records in the specified table using the values defined in the request body.

Example:

Code Block
themeEclipse
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 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.

Info

If the parameter is not set, the response to the request returns the values of all columns of the table.



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
themeEclipse
PUT /rest/v1/table/{tableName}/{sys_id}

Image Added

Section
Section


Code Block
languagejs
themeEclipse
titleHTTP
linenumberstrue
PUT /rest/v1/table/task/166032552604350116 HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu
Content-Type: application/json
Content-Length: 20

{
  "state": "3"
}ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu
Content-Type: application/json
Content-Length: 20

{
  "state": "3"
}


Code Block
languagejs
themeConfluence
titleResponse
linenumberstrue
collapsetrue
{
    "status": "OK",
    "data": [
    {
        "sys_id": "166032552604350116",
        "state": "3",
        "priority": null,
        "urgency": null,
        "impact": null,
        "assigned_user": null,
        "assignment_group": null,
        "wf_executing_activity": null,
        "closed_by": null,
        "followers_list": null,
        "parent_id": null,
        "opened_by": null,
        "caller":
        {
            "value": "155931135900000001",
            "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
        },
        "contact": null,
        "service": null,
        "screenshot": null,
        "short_description": null,
        "work_notes": null,
        "active": true,
        "closed_at": null,
        "sla_due": null,
        "sys_updated_at": "2022-08-13 13:46:11",
        "sys_created_at": "2022-08-12 17:32:06",
        "description": null,
        "number": "TSK0000014",
        "subject": "Kickoff meeting",
        "additional_comments": null,
        "comments": null,
        "opened_at": "2022-08-12 17:32:06",
        "due_date": null,
        "attention_required": false,
        "company":
        {
            "value": "166032365806600708",
            "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/org_company/166032365806600708"
        },
        "approval_state": "not_requested",
        "sys_db_table_id": "155931135900000083",
        "display_name": "TSK0000014 Kickoff meeting",
        "sys_updated_by":
        {
            "value": "155931135900000001",
            "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
        },
        "sys_created_by":
        {
            "value": "155931135900000001",
            "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
        }
    }]
}


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


Code Block
languagejs
themeEclipse
titleHTTP
linenumberstrue
PATCH /rest/v1/table/task/166032552604350116 HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu
Content-Type: application/json
Content-Length: 43

{
  "description": "Some description"
}


Code Block
languagejs
themeConfluence
titleResponse
linenumberstrue
collapsetrue
{
    "status": "OK",
    "data": [
        {
            "active": true,
            "additional_comments": null,
            "approval_state": "not_requested",
            "assigned_user": null,
            "assignment_group": null,
            "attention_required": false,
            "caller": {
                "value": "155931135900000001",
        
Code Block
languagejs
themeConfluence
titleResponse
linenumberstrue
collapsetrue
{
    "status": "OK",
    "data": [
    {
        "sys_idlink": "166032552604350116",
http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
            },
            "stateclosed_at": "3"null,
            "priorityclosed_by": null,
            "urgencycomments": null,
            "impactcompany": null,
            "assigned_usercontact": null,
        "assignment_group    "description": "Some nulldescription",
            "wfdisplay_executing_activityname": null "TSK0000005 Some subject",
            "closeddue_bydate": null,
            "followers_list": null,
        "parent_id": null,
        "opened_byimpact": null"2",
        "caller":
        {"number": "TSK0000005",
            "valueopened_at": "1559311359000000012023-08-10 11:55:30",
            "linkopened_by": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"
  null,
      },
        "contactparent_id": null,
            "servicepriority": null"2",
        "screenshot": null,
        "short_description"screenshot": null,
        "work_notes    "service": null,{
        "active": true,
        "closed_atvalue": null"157416651911910348",
        "sla_due": null,
       "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/sys_updated_at": "2022-08-13 13:46:11",
_cmdb_ci_service/157416651911910348"
          "sys_created_at": "2022-08-12 17:32:06" },
            "short_description": null,
            "numbersla_due": "TSK0000014"null,
            "subjectstate": "Kickoff meeting1",
         "additional_comments": null,
   "state_changed_at": "2023-08-10 11:55:30",
            "commentssubject": "Some nullsubject",
        "opened    "sys_created_at": "20222023-08-1210 1711:32:06",
        "due_date": null55:30",
        "attention_required": false,
        "companysys_created_by": {
        {
            "value": "166032365806600708155931135900000001",
                "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/org_companyuser/166032365806600708155931135900000001"
            },
            "approval_statesys_db_table_id": "not_requested155931135900000083",
            "sys_db_table_id": "155931135900000083169166853014539923",
            "displaysys_updated_nameat": "TSK0000014 Kickoff meeting2023-08-10 11:56:25",
            "sys_updated_by": {
        {
            "value": "155931135900000001169166788816565275",
                "link": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001169166788816565275"
            },
        "sys_created_by":
        {"urgency": "2",
            "valuewf_executing_activity": "155931135900000001"null,
            "linkwork_notes": "http://sandbox-01.dev.simpleone.ru/rest/v1/table/user/155931135900000001"null
        }
    }]
}



DELETE

operations

operation


Use this method to delete a specified 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:

Image Modified

Code Block
languagejs
themeEclipse
titleHTTP
linenumberstrue
DELETE /rest/v1/table/sys_filter/166039918402151705 HTTP/1.1
Host: sandbox-01.dev.simpleone.ru
Authorization: Bearer 70xlHwLAgSeBKF7Dafbu-lcUrWlvw4eu

Success response


Code Block
languagejs
themeConfluence
titleSuccess response
linenumberstrue
{
    "status": "OK",
    "data": {
        "description": "Records successfully deleted."
}

Error response


Code Block
languagejs
themeConfluence
titleError response
linenumberstrue
{
    "status": "ERROR",
    "error_type": "SERVER",
    "errors": [
        {
            "message": "You have no access to delete this records."
        }
    ]
}


Table of Contents
absoluteUrltrue
classfixedPosition