Web API for Datatables: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
 
(10 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|importfile method]].
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.
* 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.  
* 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.
* name (string): Datatable name.
* Description (string): Datatable description.
* description (string): Datatable description.
* CreatedDate (datetime): Datatable creation date.
* nColumns (integer): Number of columns in the datatable.
* CreatorId (integer): Id of the user who created the datatable.
* nRows (integer): Number of rows in the datatable.
* LastModifiedDate (datetime): Date when the datatable properties where last modified.
* createdDate (datetime): Datatable creation date.
* LastModifierId (integer): Id of the user who last modified the datatable properties.
* creatorId (integer): Id of the user who created the datatable.
* LastImportedDate (datetime): Date when data was last imported to the datatable.
* lastModifiedDate (datetime): Date when the datatable properties where last modified.
* LastImporterId (integer): Id of the user who last time imported data to the datatable.
* lastModifierId (integer): Id of the user who last modified the datatable properties.
* NColumns (integer): Number of columns in the datatable.
* lastImportedDate (datetime): Date when data was last imported to the datatable.
* NRows (integer): Number of rows in 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.
* 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.
Only the following properties in datatable objects can be modified: Name, Description and ProjectId.
Line 22: Line 24:
The datatables API has the following methods.
The datatables API has the following methods.


=== List datatables ===
<pre>
<pre>
GET api/datatables
GET api/datatables
</pre>
</pre>
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.
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>
Line 31: Line 36:
</pre>
</pre>
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.
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>
Line 36: Line 43:
</pre>
</pre>
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.
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>
Line 41: Line 50:
</pre>
</pre>
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.
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>
Line 47: Line 58:
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.
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.


== UI Elements API ==
=== Copy datatable ===
 
The following UI elements API operations also support datatables:


<pre>
<pre>
POST /api/uielements/setproject/{projectid}
POST api/datatables/copy/{id}
</pre>
</pre>
Supports also datatable objects. Will be used when multiple datatables (and also other objects) are moved between projects.
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.


<pre>
[[Category: QPR ProcessAnalyzer]]
DELETE /qprpa/api/uielements
</pre>
Supports also datatable objects. Will be used when multiple datatables (and also other objects) are deleted.

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.