E-mails ontvangen: bijlagen

Delete Attachment

Verwijder een geüpload bestand voordat de e-mail wordt verstuurd.

POSThttps://g.sendcorex.com/v1command: delete_attachment

Argumenten

  • compose_uidstringverplicht

    De compose waar het bestand bij hoort.

  • attachment_idstringverplicht

    Het id dat upload_attachment teruggaf.

Snel starten

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "delete_attachment",
        args: {
          compose_uid: "Vj0xQ01QMDAx",
          attachment_id: "6f1c2a9e-4b7d-4e21-9a3f-0c8d5e7b1a42"
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

Response

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "delete_attachment",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "deleted": true
      }
    }
  ]
}

Fouten

Fouten op HTTP-niveau geven type, code en message terug. Fouten met CMD komen terug in het resultaat van de opdracht, met HTTP 200.

  • 401TOKEN_EXPIRED

    De access token is verlopen. Roep Refresh Token aan en herhaal het request.

  • 401INVALID_TOKEN

    De token is ongeldig, onbekend of ingetrokken.

  • 429RATE_LIMITED

    Meer dan 15 requests/s of 15 tegelijk voor hetzelfde IP + mailbox. Wacht het aantal seconden uit Retry-After.

  • CMDINVALID_ARGS

    Een verplicht argument ontbreekt of is ongeldig.

  • CMDALREADY_SENT

    De compose_uid hoort bij een e-mail die al is verstuurd.

  • CMDINTERNAL

    Serverfout. Het detail wordt alleen in het serverlog geschreven.