Web API for Models: Difference between revisions
Line 18: | Line 18: | ||
* 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. | ||
* 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. |
Latest revision as of 10:50, 16 October 2024
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.
Note that the Workspace Elements API supports also models.
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.
- 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 a model entity by the model id. 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 entity in the body (read-only properties are ignored). Returns the created model entity. If current user has no rights to create model, unauthorized error is returned.
PUT api/models/{id}
Updates properties of an existing model with the given id. The method takes the model entity in the body (model id in the entity should match the model id given in url). 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 a model with given id. Supports optional query parameter deletePermanently (boolean, false by default), which indicates whether to delete the model permanently. If the 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 as PACM format. Returns the model content as a stream in the PACM format. If model doesn't exist, not found error is returned. If current user has no access to the model, unauthorized error is returned.