Skip to main content
Soft-deletes or trashes multiple files and folders in a single request
PUT https://services.leadconnectorhq.com/medias/delete-files

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

filesToBeDeleted
object[]
required
Array of file objects to be deleted or trashed
altType
string
default:"account"
required
Type of entity that owns the files Posibles valores: ‘account’
altId
string
default:"sx6wyHhbFdRXh302LLNR"
required
Account identifier
status
string
default:"deleted"
required
Status to set for the files (deleted or trashed) Posibles valores: ‘deleted’, ‘trashed’

Respuestas

[
  {
    "deleted": true,
    "id": "686f630df0d3166d68fbcec2"
  }
]

Ejemplo

curl -X PUT 'https://services.leadconnectorhq.com/medias/delete-files' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "filesToBeDeleted": [
    {
      "_id": "686f630df0d3166d68fbcec2"
    }
  ],
  "altType": "account",
  "altId": "sx6wyHhbFdRXh302LLNR",
  "status": "deleted"
}'
const response = await fetch('https://services.leadconnectorhq.com/medias/delete-files', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"filesToBeDeleted": [{"_id": "686f630df0d3166d68fbcec2"}], "altType": "account", "altId": "sx6wyHhbFdRXh302LLNR", "status": "deleted"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'PUT',
    'https://services.leadconnectorhq.com/medias/delete-files',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"filesToBeDeleted": [{"_id": "686f630df0d3166d68fbcec2"}], "altType": "account", "altId": "sx6wyHhbFdRXh302LLNR", "status": "deleted"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/medias/delete-files');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'filesToBeDeleted': [{'_id': '686f630df0d3166d68fbcec2'}], 'altType': 'account', 'altId': 'sx6wyHhbFdRXh302LLNR', 'status': 'deleted'}),
]);
$data = json_decode(curl_exec($ch), true);