Web API for Datatables: Difference between revisions
No edit summary |
|||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Datatables API is used to create, delete and edit datatable properties. To import data to datatables, use the [[Web_API:_Importfile| | Datatables API is used to create, delete and edit datatable properties. To import data to datatables, use the [[Web_API:_Importfile|importfile method]]. | ||
Note that the [[Web API for Workspace Elements|Workspace Elements API]] supports also datatables. | |||
==Datatable Entity== | ==Datatable Entity== | ||
The datatables API is based on the '''datatable''' entity, which has the following properties: | The datatables API is based on the '''datatable''' entity, which has the following properties: | ||
* | * id (integer): Datatable id. | ||
* | * projectId (integer): Id of the project where the datatable is located. The datatable is moved to another project by changing this property. | ||
* | * name (string): Datatable name. | ||
* | * description (string): Datatable description. | ||
* | * nColumns (integer): Number of columns in the datatable. | ||
* | * nRows (integer): Number of rows in the datatable. | ||
* | * createdDate (datetime): Datatable creation date. | ||
* | * creatorId (integer): Id of the user who created the datatable. | ||
* | * lastModifiedDate (datetime): Date when the datatable properties where last modified. | ||
* | * lastModifierId (integer): Id of the user who last modified the datatable properties. | ||
* | * lastImportedDate (datetime): Date when data was last imported to the datatable. | ||
* lastImporterId (integer): Id of the user who last time imported data to the datatable. | |||
* log (string): Modification and import log. Returned only when a separate parameter is specified, otherwise empty. | |||
Only the following properties can be modified: Name, Description and ProjectId. | Only the following properties in datatable objects can be modified: Name, Description and ProjectId. | ||
==Methods== | ==Methods== | ||
The datatables API has the following methods. | |||
=== List datatables === | |||
<pre> | <pre> | ||
GET api/datatables | GET api/datatables | ||
</pre> | </pre> | ||
Gets | Gets an array of all datatable entities the user has permissions. Optional query parameter is ''projectId'' (integer) which is used to get datatables only from one project. | ||
=== Get datatable === | |||
<pre> | <pre> | ||
GET api/datatables/{id} | GET api/datatables/{id} | ||
</pre> | </pre> | ||
Returns datatable | Returns a datatable entity with given id. Supports optional parameter ''includeLog'' (boolean, false by default) to return also the ''Log'' property of the datatable. If datatable with given id doesn't exist, ''not found error'' is returned. If the current user has no access to the datatable, ''unauthorized error'' is returned. | ||
=== Create datatable === | |||
<pre> | <pre> | ||
POST api/datatables | POST api/datatables | ||
</pre> | </pre> | ||
Creates a new empty datatable. Takes the datatable | Creates a new empty datatable. Takes the datatable entity in the body. Returns the created datatable entity. If current user has no rights to create the datatable, ''unauthorized error'' is returned. | ||
=== Edit datatable === | |||
<pre> | <pre> | ||
PUT api/datatables/{id} | PUT api/datatables/{id} | ||
</pre> | </pre> | ||
Updates information of | Updates information of an existing datatable with the given id. Takes the datatable properties object in the body. Id property in the datatable entity is ignored. If datatable with given id doesn't exist, ''not found error'' is returned. If current user has no rights to modify the datatable, ''unauthorized error'' is returned. | ||
=== Delete datatable === | |||
<pre> | <pre> | ||
DELETE api/datatables/{id} | DELETE api/datatables/{id} | ||
</pre> | </pre> | ||
Deletes | Deletes a datatable with given id. If datatable with the given id doesn't exist, ''not found error'' is returned. If current user has no rights to delete the datatable, ''unauthorized error'' is returned. | ||
=== Copy datatable === | |||
<pre> | <pre> | ||
POST | POST api/datatables/copy/{id} | ||
</pre> | </pre> | ||
Creates a new datatable and copies data to it from another datatable (datatable id provided as a parameter). Copying the data is done in the background, so the operation returns after creating the datatable and continues the copying after that. Similar to creating a new datatable, takes the new datatable entity in the body. Returns the created datatable id (DataTableId) and operation id (OperationId) of the copying operation. | |||
[[Category: QPR ProcessAnalyzer]] | |||
Latest revision as of 22:38, 12 December 2020
Datatables API is used to create, delete and edit datatable properties. To import data to datatables, use the importfile method.
Note that the Workspace Elements API supports also datatables.
Datatable Entity
The datatables API is based on the datatable entity, which has the following properties:
- id (integer): Datatable id.
- projectId (integer): Id of the project where the datatable is located. The datatable is moved to another project by changing this property.
- name (string): Datatable name.
- description (string): Datatable description.
- nColumns (integer): Number of columns in the datatable.
- nRows (integer): Number of rows in the datatable.
- createdDate (datetime): Datatable creation date.
- creatorId (integer): Id of the user who created the datatable.
- lastModifiedDate (datetime): Date when the datatable properties where last modified.
- lastModifierId (integer): Id of the user who last modified the datatable properties.
- lastImportedDate (datetime): Date when data was last imported to the datatable.
- lastImporterId (integer): Id of the user who last time imported data to the datatable.
- log (string): Modification and import log. Returned only when a separate parameter is specified, otherwise empty.
Only the following properties in datatable objects can be modified: Name, Description and ProjectId.
Methods
The datatables API has the following methods.
List datatables
GET api/datatables
Gets an array of all datatable entities the user has permissions. Optional query parameter is projectId (integer) which is used to get datatables only from one project.
Get datatable
GET api/datatables/{id}
Returns a datatable entity with given id. Supports optional parameter includeLog (boolean, false by default) to return also the Log property of the datatable. If datatable with given id doesn't exist, not found error is returned. If the current user has no access to the datatable, unauthorized error is returned.
Create datatable
POST api/datatables
Creates a new empty datatable. Takes the datatable entity in the body. Returns the created datatable entity. If current user has no rights to create the datatable, unauthorized error is returned.
Edit datatable
PUT api/datatables/{id}
Updates information of an existing datatable with the given id. Takes the datatable properties object in the body. Id property in the datatable entity is ignored. If datatable with given id doesn't exist, not found error is returned. If current user has no rights to modify the datatable, unauthorized error is returned.
Delete datatable
DELETE api/datatables/{id}
Deletes a datatable with given id. If datatable with the given id doesn't exist, not found error is returned. If current user has no rights to delete the datatable, unauthorized error is returned.
Copy datatable
POST api/datatables/copy/{id}
Creates a new datatable and copies data to it from another datatable (datatable id provided as a parameter). Copying the data is done in the background, so the operation returns after creating the datatable and continues the copying after that. Similar to creating a new datatable, takes the new datatable entity in the body. Returns the created datatable id (DataTableId) and operation id (OperationId) of the copying operation.