Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Sending Requests: Delete Requests.

Mihou edited this page Jun 22, 2021 · 1 revision

✏️ Delete Request

You can use the Queria format:

database.collection.delete(identifier, {"unique":"Unique value for callbacks, 
this is optional. This will also not be added to the value, don't worry."})

If you don't need the unique value for callbacks, feel free to use below:

database.collection.delete(identifier)

Or you can choose to use the JSON format which has fields as written below.

The method field must be delete for this request.

Delete Item Request

FIELD TYPE DESCRIPTION
method string The type of request to send.
database string The database to store the item.
collection string The collection to store the item.
identifier string The identifier name of the item to remove.
unique string The unique value to return (used for getting back exact responses from the server).

Delete Item Response

FIELD TYPE DESCRIPTION
response json Replies back with something among the likes of: "The item {{identifier}} was deleted."
kode integer The server reply code (1 for success, 0 for no results, -1 for invalid request).
replyTo string The unique code sent back (for callbacks).

Delete Item Example Response

{
    "response": "The item [identifier] was deleted.",
    "kode": 1,
    "replyTo": "Unique identifier from request"
}

Delete Key or Field Request

You can use the Queria format:

database.collection.delete(identifier, {"key":"value","unique":"Unique value for callbacks, this is optional. This will also not be added to the value, don't worry."})

If you don't need the unique value for callbacks, feel free to use below:

database.collection.delete(identifier, {"key":"value"})

Or you can choose to use the JSON format which has fields as written below.

FIELD TYPE DESCRIPTION
method string The type of request to send.
database string The database to store the item.
collection string The collection to store the item.
identifier string The identifier name of the item to remove.
key string The key name of the field to remove.
unique string The unique value to return (used for getting back exact responses from the server).

Delete Multiple Keys or Fields Request

You can use the Queria format:

database.collection.delete(identifier, {"key":["key1","key2"],"value":["value1","value2"],"unique":"Unique value for callbacks, this is optional. This will also not be added to the value, don't worry."})

If you don't need the unique value for callbacks, feel free to use below:

database.collection.delete(identifier, {"key":["key1","key2"],"value":["value1","value2"]})

Or you can choose to use the JSON format which has fields as written below.

FIELD TYPE DESCRIPTION
method string The type of request to send.
database string The database to store the item.
collection string The collection to store the item.
identifier string The identifier name of the item to remove.
keys array of string The key names of the fields to remove.
unique string The unique value to return (used for getting back exact responses from the server).

Delete Field and Fields Response

FIELD TYPE DESCRIPTION
response json Replies back with the new JSON value of the item.
kode integer The server reply code (1 for success, 0 for no results, -1 for invalid request).
replyTo string The unique code sent back (for callbacks).

Example of Delete Field and Fields Response

{
    "response": "{\"id\":\"1.2\"}",
    "kode": 1,
    "replyTo": "Unique String"
}