Delete
The delete
method removes a record from the collection.
Configuration Example
# spec.yml
name: Collection Name
methods:
delete:
parametersSchema:
type: object
properties:
hardDelete:
type: boolean
default: false
description: Permanently delete instead of soft delete
Implementation Examples
REST API Mapping Implementation (Recommended)
File: delete.rest.yml
path: /contacts/{id}
method: DELETE
requestMapping:
pathParameters:
id: { $var: $.id }
query:
permanent: { $var: $.parameters.hardDelete }
responseMapping:
success: true
JavaScript Implementation
File: delete.js
export default async function deleteRecord({ apiClient, id, parameters }) {
const queryParams = {}
if (parameters?.hardDelete) {
queryParams.permanent = true
}
await apiClient.delete(`/contacts/${id}`, { params: queryParams })
return {
success: true,
}
}
Input
Property | Type | Description |
---|---|---|
id | string | The ID of the record to delete |
credentials | object | Authentication credentials |
parameters | object | Method-specific parameters |
Updated 2 days ago