If you want to delete the data permanently, use the delete
function.
Now, let’s see how to use the delete
function.
- The
delete
function deletes the records altogether. The records cannot be retrieved later. -
arcql
parameter is used to select the records using the ArcQL query statement.
delete(type: HypiMutationType!, arcql: String!,clearArrayReferences:Boolean=false): Int!
- Maximum 25 records can be deleted in one request
-
clearArrayReferences
is false by default. It has to be set while deleting the object arrays or the objects with one-to-many references.
Just like the previous posts, we will work with the same ReadObject data type here. We will see how to delete object arrays in a separate post.
type ReadObject {
field1: String
field2: Int
}
Sample Query
mutation {
delete(type: ReadObject, arcql: "hypi.id = '01FGXSXWZDD62D68EJSD186NTP'")
}
#result
{
"data": {
"delete": 1
}
}
Output
The delete
function returns the number of records deleted.
Query with Variables
mutation deleteObject(
$type: HypiMutationType!
$arcql: String!
$clearArrayReferences: Boolean = false
) {
delete(
type: $type
arcql: $arcql
clearArrayReferences: $clearArrayReferences
)
}
#query variables
{
"type": "ReadObject",
"arcql": "hypi.id = '01FGXSXWZDRWZE2X9ZGH7Y7103'",
"clearArrayReferences": false
}
Please note query variables has the form of JSON.
Check the POSTMAN collection for the delete
requests in different programming languages! Click </>
and choose the programming language of your choice.
Don’t forget to insert your own Authorization key and Hypi Domain under Headers to test the results!