Web API for Models: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
(Created page with "Models API is used to create models, delete models and edit model properties. Data is imported to models by importing data to the datatables used by the model. ==Model Entity...")
 
No edit summary
Line 1: Line 1:
Models API is used to create models, delete models and edit model properties. Data is imported to models by importing data to the datatables used by the model.
Models API is used to create models, delete models and edit model properties. Data import is not done using the models API, but data is imported directly to the datatables used by the model.


==Model Entity==
==Model Entity==
The models API is based on the '''model''' entity, which has the following properties:
The models API is based on the Model entity, which has the following properties:
* Id (integer): model id.
* Id (integer): model id.
* ProjectId (integer): Id of the project where the model is located. The datatable is moved to another project by changing this property.  
* ProjectId (integer): Id of the project where the model is located. The model is moved to another project by changing this property.  
* Name (string): Model name.
* Name (string): Model name.
* Description (string): Model description.
* Description (string): Model description.
* CreatedDate (datetime): Model creation date.
* CreatedDate (datetime): Model creation date.
* CreatorId (integer): Model creator user id.
* CreatorId (integer): Model creator user id.
* LastModifiedDate (datetime): Model last modification date
* LastModifiedDate (datetime): Model last modification date.
* LastModifierId (integer): Model last modifier user id
* LastModifierId (integer): Model last modifier user id.
* NCases (integer): number of cases in the model.
* NCases (integer): Number of cases in the model.
* NEvents (integer): number of events in the model.
* NEvents (integer): Number of events in the model.
* NEventTypes (integer): number of event types in the model.
* NEventTypes (integer): Number of event types in the model.
* NCaseAttributes (integer): number of case attributes in the model.
* NCaseAttributes (integer): Number of case attributes in the model.
* NEventAttributes (integer): number of event attributes in the model.
* NEventAttributes (integer): Number of event attributes in the model.
* NFilters (integer): number of filters in the model.
* NFilters (integer): Number of filters in the model.
* NAnalyses (integer): number of analyses in the model.
* NAnalyses (integer): Number of analyses in the model.
* Configuration (JSON object): Model configuration JSON.
* Configuration (JSON object): Model configuration JSON.


Only the following properties in model objects can be modified: Name, Description, ProjectId and Configuration.
The following properties in model objects can be modified: Name, Description, ProjectId and Configuration.


All model statistics are calculated and stored to the model when the model is loaded into memory.
All object counts properties are calculated and stored to the model when the model is loaded into memory.


==Methods==
==Methods==
Line 30: Line 30:
GET api/models GET
GET api/models GET
</pre>
</pre>
Gets the list of models (that are not deleted). Supported query parameter is ''projectId'' (integer, optional): project id to get models from (all existing models from all active projects are returned by default). Returns array of model objects that are accessible for the current user (can be empty if criteria specified by parameters is not matched).
Gets a list of all not deleted models in the system (if no parameter is provided). Supports optional query parameter ''projectId'' which is project id where to get models from.


<pre>
<pre>
Line 66: Line 66:
</pre>
</pre>
Support also models (will be used when multiple models are deleted). It also should support ''deletePermanently'' query parameter (see api/models/{id} DELETE).
Support also models (will be used when multiple models are deleted). It also should support ''deletePermanently'' query parameter (see api/models/{id} DELETE).
[[Category: QPR ProcessAnalyzer]]

Revision as of 16:12, 1 November 2020

Models API is used to create models, delete models and edit model properties. Data import is not done using the models API, but data is imported directly to the datatables used by the model.

Model Entity

The models API is based on the Model entity, which has the following properties:

  • Id (integer): model id.
  • ProjectId (integer): Id of the project where the model is located. The model is moved to another project by changing this property.
  • Name (string): Model name.
  • Description (string): Model description.
  • CreatedDate (datetime): Model creation date.
  • CreatorId (integer): Model creator user id.
  • LastModifiedDate (datetime): Model last modification date.
  • LastModifierId (integer): Model last modifier user id.
  • NCases (integer): Number of cases in the model.
  • NEvents (integer): Number of events in the model.
  • NEventTypes (integer): Number of event types in the model.
  • NCaseAttributes (integer): Number of case attributes in the model.
  • NEventAttributes (integer): Number of event attributes in the model.
  • NFilters (integer): Number of filters in the model.
  • NAnalyses (integer): Number of analyses in the model.
  • Configuration (JSON object): Model configuration JSON.

The following properties in model objects can be modified: Name, Description, ProjectId and Configuration.

All object counts properties are calculated and stored to the model when the model is loaded into memory.

Methods

The models API has the following methods.

GET api/models GET

Gets a list of all not deleted models in the system (if no parameter is provided). Supports optional query parameter projectId which is project id where to get models from.

GET api/models/{id}

Gets information of the model with given id. Returns the model object. If model doesn't exist, not found error is returned. If current user has no access to the model, unauthorized error is returned.

POST api/models

Creates a new empty model. Takes the model object in the body (whose read-only fields are ignored). Returns the created model object. If current user has no rights to create model, unauthorized error is returned.

PUT api/models/{id}

Updates information of the existing model with the given id. Supported query parameter is moveLinkedDatatables (boolean, true by default): flag whether to move linked data tables to the new project if model itself is moved, otherwise ignored. Takes the model object in the body (whose id should match the path parameter value and other read-only fields are ignored). If model doesn't exist, not found error is returned. If current user has no rights to modify the model, unauthorized error is returned.

DELETE api/models/{id}

Deletes the model with given id. Supported query parameter is deletePermanently (boolean, false by default): flag whether to delete the model permanently. If model doesn't exist, not found error is returned. If current user has no rights to delete the model, unauthorized error is returned.

GET api/models/export/{id}

Exports the model with given id to PACM format. Returns the model content as stream in PACM format (compressed). If model doesn't exist, not found error is returned. If current user has no access to the model, unauthorized error is returned.

POST /api/uielements/setproject/{projectid}

Support also models (will be used when multiple models are moved between projects). It also should support moveLinkedDatatables query parameter (see api/models/{id} PUT).

DELETE /qprpa/api/uielements

Support also models (will be used when multiple models are deleted). It also should support deletePermanently query parameter (see api/models/{id} DELETE).