How to put unwanted data in the trash

Sometimes you may want to put the unwanted data in the trash before deleting it altogether.

Now, let’s see how to put unwanted data in the trash.

  • The trash function marks the records as trash

trash(type: HypiMutationType!, arcql: String!): Int!

  • The get and find queries do not display the trashed objects by default
  • ArcQL filter is used to select the records to be trashed

Just like the previous post, we will work with the same ReadObject data type here.

type ReadObject {
   field1: String
   field2: Int
}

Sample Query

mutation {
  trash(type: ReadObject, 
  arcql: "hypi.id = '01FH5MKT5ZXHA7KNKTAK48H6KP'")
}
#result
{
  "data": {
    "trash": 1
  }
}

Output
The trash function returns the number of records marked as trash.

Query with Variables

mutation trashObject($type: HypiMutationType!, $arcql: String!) {
  trash(type: $type, arcql: $arcql)
}

#query variables
{
  "type": "ReadObject",
  "arcql": "hypi.id = '01FH5MKT5ZXHA7KNKTAK48H6KP'"
} 

Please note query variables has the form of JSON.

Check the POSTMAN collection for the trash 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!
Run in Postman