Web API for Datatables: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
Line 20: Line 20:


==Methods==
==Methods==
The datatables API has the following methods.


<pre>
<pre>
GET api/datatables
GET api/datatables
</pre>
</pre>
Gets list of all datatables the user has permissions, except datatables that are in the recycle bin. Optional query parameter is ''projectId'' (integer) to get datatables from. Returns array of datatable objects.
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.


<pre>
<pre>
GET api/datatables/{id}
GET api/datatables/{id}
</pre>
</pre>
Returns datatable object with given id. Supports optional parameter ''includeLog'' (boolean, false by default) to return also the Log property of the data table. If datatable with given id doesn't exist, not found error is returned. If 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.


<pre>
<pre>
POST api/datatables
POST api/datatables
</pre>
</pre>
Creates a new empty datatable. Takes the datatable properties object in the body. Returns the created data table object. If current user has no rights to create 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.


<pre>
<pre>
PUT api/datatables/{id}
PUT api/datatables/{id}
</pre>
</pre>
Updates information of the existing datatable with the given id. Takes the datatable properties object in the body. 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.


<pre>
<pre>
DELETE api/datatables/{id}
DELETE api/datatables/{id}
</pre>
</pre>
Deletes the datatable with given id. If datatable with 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 ==
== UI Elements API ==

Revision as of 22:11, 27 August 2020

Datatables API is used to create, delete and edit datatable properties. To import data to datatables, use the importfile method.

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.
  • 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.
  • NColumns (integer): Number of columns in the datatable.
  • NRows (integer): Number of rows in 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.

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

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.

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

UI Elements API

The following UI elements API operations also support datatables:

POST /api/uielements/setproject/{projectid}

Supports also datatable objects. Will be used when multiple datatables (and also other objects) are moved between projects.

DELETE /qprpa/api/uielements

Supports also datatable objects. Will be used when multiple datatables (and also other objects) are deleted.