Deleting and restoring block models
Deleting a block model
Delete the block model bm_id in the workspace workspace_id using the Delete a block model endpoint.
When a block model has been deleted, requests that attempt to retrieve or modify it or its child resources will fail with an HTTP status code of 410 Gone, with the exception of Getting a block model, Listing block models, and Restoring block models, dependent on query parameter usage.
The following are considered child resources of a block model.
Requests that attempt to update or query the blocks or columns of a block model are considered to access the Versions of a block model.
The API does not enforce uniqueness in the name attribute of deleted block models.
Request
| Method | Request URL |
|---|---|
| DELETE | /orgs/{org_id}/workspaces/{workspace_id}/block-models/{bm_id} |
Response
On success, the API will respond with the HTTP status code 204 No Content. Deleting a block model that has already been deleted will succeed with the same status code.
Restoring a block model
Restores the deleted block model bm_id using the Restore a block model endpoint. The restrictions around modifying or retrieving the block model or its blocks will be removed.
Request
| Method | Request URL |
|---|---|
| POST | /orgs/{org_id}/workspaces/{workspace_id}/block-models/{bm_id} |
Query parameters
| Query parameter | Description |
|---|---|
| deleted | Required. You must provide the boolean parameter deleted and set it to false when using this endpoint, otherwise the API will respond with the HTTP status code 400 Bad Request. |
Response
On success, the API will respond with the HTTP status code 202 Accepted, along with the BlockModel object in the response body.
Example: Restoring a block model that has a naming conflict
To start off, we have two block models in the workspace workspace_id, bm_id_1 and bm_id_2. The block model bm_id_1 has been deleted, and the block model bm_id_2 has not.
The block models share the same name "My excellent gold mine", as is allowed in BlockSync due to the deletion status of bm_id_1.
To restore the block model bm_id_1, the following request is used.
| Method | Request URL |
|---|---|
| POST | /orgs/{org_id}/workspaces/{workspace_id}/block-models/{bm_id_1}?deleted=false |
The request succeeds and the API responds with HTTP status code 202 Accepted, along with a response body containing the BlockModel object.
As there already exists a block model with the name "My excellent gold mine", the API has resolved the conflict by changing the name of bm_id_1 to "My excellent gold mine (1)" following the convention outlined above.