Skip to main content

Delete Data

Delete data endpoint allows you to delete the data in your collection. You can delete all the data for a collection, or you can delete specific deals by specifying the id.

The procedure to delete the data of a collection is as follows:

  1. send a DEL request to the delete data endpoint with the specified ids;
  2. retrieve the request id from the response;
  3. poll the platform periodically to check the status of the delete request to ensure that the data deletion is successful.

1. Send a DEL request

To delete data, you need to send a DEL request to the delete data endpoint:

/api/collection/{collectionId}/data/deals/delete

This endpoint requires:

  • collectionId: the identifier of the collection containing the data you want to delete;

In the request body, you can specify the ids of deals you want to delete in args as a JSON object:

  • ids, the list of deals ids to delete.

ids is an optional parameter. If not specified, all the data of the specified collection will be deleted.

The request must also include an header with the authorization token.

An example of the request to delete the multiple ids is shown below.

curl --location'https://nostradamus.u-hopper.com/api/collection/{my-collection-id}/data/deals/delete' \
--header 'Authorization: Token my-secret-token' \
--header 'Content-Type: application/json' \
--data '{
"args": {
"ids": ["AD12N25", "AD12N26", "AD12N27"]
}
}'

2. Retrieve the request id

If the delete request is successful (status code 202), the response will follow the UploadRequest schema defined in the OpenApi documentation. The id field in the response will contain the identifier of the delete request you just sent, and the status field will be set to queued. You will need the identifier to check the status of the delete request.

If the request is unsuccessful, the response will contain the error message.

An example of the response is shown below:

{
"id": "my-delete-request-id",
"collectionId": "my-collection-id",
"dataType": "deals",
"args": {
"ids": ["AD12N25"]
},
"status": "queued",
"message": null,
"deletionErrors": null
}

3. Poll the platform to check the status of the delete request

To retrieve the status of a delete request, you can send a GET request to the following endpoint, replacing my-upload-request-id with the id of the delete request:

/api/collection/{collectionId}/data/deals/delete/{my-upload-request-id}

Here is an example of how to check the status of the delete request with id my-delete-request-id:

curl --location 'https://nostradamus.u-hopper.com/api/collection/{my-collection-id}/data/deals/delete/{my-delete-request-id}' \
--header 'Authorization: Token my-secret-token'

The response (if the request succeeded, i.e. status code 200) will follow the DeleteRequest schema defined in the OpenApi documentation. The status field in the response will indicate the status of the request.

The status can be one of the following values: queued, in_progress, completed, error. In particular:

  • a status queued indicates that the request has been received by the platform and is waiting to be processed;
  • a status in_progress indicates that the request is being processed;
  • a status completed indicates that the deletion process is successfully terminated and your data has been deleted from the collection;
  • a status error indicates that the deletion process terminated with errors; the failure motivation will appear in the field deletionErrors of the response; the existing data in the collection will not be modified.

An example of the response is shown below:

{
"id": "my-delete-request-id",
"collectionId": "my-collection-id",
"dataType": "deals",
"args": {
"ids": ["AD12N25"]
},
"status": "completed",
"message": null,
"deletionErrors": null
}

You may need to poll the platform periodically to check the status of your delete request. This ensures that you receive timely updates on the progress and outcome of your request.