Delete Media

PUT {{URL}}/v1/services/media/gc

Use the PUT request to the /v1/services/media/gc endpoint to delete media from the database and media storage associated with your WhatsApp Business API client.

Response

Webhook notifications

Since the API request works asynchronously, once the garbage collection on the media table is complete, the WhatsApp Business API client will post a notification to the callback server in the following format.

Account ID: None Request ID: f1b61336390f46d8965888eaa6e8800b 10.254.254.254 - - [14/Jul/2020 13:01:15] "POST / HTTP/1.1" 200 - { "services": [{ "media": { "gc": { "items_deleted": 5, "status": "complete" } } }] }

Errors

If the API request fails to initiate garbage collection, an error will be returned in the HTTP response.

{ "meta": { "version": "v2.49.1", "api_status": "stable" }, "errors": [{ "code": 1014, "title": "Internal error", "details": "Connection timed out. Please check if wacore is running: wacore:6252" }] }

Completion Failure

If the garbage collection fails to complete, an error will be returned in the Webhook notification.

Account ID: None Request ID: 192953cb41a547d0ab19bfde59bff010 10.254.254.254 - - [13/Jul/2020 10:07:51] "POST / HTTP/1.1" 200 - { "services": [{ "media": { "gc": { "items_deleted": 0, "errors": [{ "code" : 1014, "details" : "Failed to fetch media to delete", }], "status": "failed" } } }] }

HEADERS

| Key | Datatype | Required | Description | | Content-Type | string | | | | Authorization | string | | |

RESPONSES

status: OK

{"services":{"media":{"gc":{"status":"processing"}}},"meta":{"api_status":"stable","version":"v2.49.1"}}