How to delete data using the REST API

We have seen reading data with the ArcQL filter using the REST API in the previous post.

Let’s delete the data now using the REST API. You can use the hypi.id of the resource to delete the data.

Data can be deleted using the DELETE method. Here is a sample endpoint to delete the data.

  • https://api.staging.hypi.dev/rest/v1/StudentMedicalRecord/01FTDB1JQQEKZ5D4PZ5D3W1PMJ?clearArrayReferences=false

The endpoint rest/v1/ is appended with the type and hypi.id of the object to be deleted. Here, our data type is StudentMedicalRecord and 01FTDB1JQQEKZ5D4PZ5D3W1PMJ is the object. Replace these two values with your own data type and hypi.id values.

Additionally, pass on clearArrayReferences 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/01FTDB1JQQEKZ5D4PZ5D3W1PMJ?clearArrayReferences=false' \
--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 POSTMAN collection for the data deletion request in different programming languages! Click </> and choose the programming language of your choice.

Run in Postman