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

PropertyTypeDescription
idstringThe ID of the record to delete
credentialsobjectAuthentication credentials
parametersobjectMethod-specific parameters