How to delete data with the ArcQL filter using the REST API

We have seen deleting data using the REST API in the previous post.

Let’s delete the data now with the ArcQL filter using the REST API. You can use the arcql filter to select the resource to delete the data.

As you know, data can be deleted using the DELETE method. Here, we will just change the endpoint to delete the data. Instead of hypi.id, we will use arcql statement to select the records to be deleted.

  • https://api.staging.hypi.dev/rest/v1/StudentMedicalRecord?clearArrayReferences=false&arcql=height=5.5

The endpoint rest/v1/ is appended with the type, clearArrayReferences value and arcql statement to select the records to be deleted. Here, our data type is StudentMedicalRecord and arcql=height=5.5 is the arcql statement. Replace these two values with your own data type and hypi.id values.

Again, we are passing [clearArrayReferences](https://docs.hypi.app/docs/delete-data#delete) as a query parameter. If you are using one-to-many references, you will not be able to delete data without unlinking the references. In that case, set clearArrayReferences to true. By default, you can keep the value false.

Here is the sample cURL request.

Sample

curl --location --request DELETE 'https://api.staging.hypi.dev/rest/v1/StudentMedicalRecord?clearArrayReferences=false&arcql=height=5.5' \
--header 'hypi-domain: inclemency.apps.hypi.app' \
--header 'content-type: application/json' \
--header 'authorization: Auth_Key'

***Replace url, hypi-domain, authorization with your own set of values.

Check the Delete Data with DELETE (using ArcQL filter) POSTMAN collection for the data deletion request in different programming languages! Click </> and choose the programming language of your choice.

Run in Postman