From 5554b03b6bb69afc0d4317099d798db4f95f71ed Mon Sep 17 00:00:00 2001 From: yaziine Date: Mon, 8 Jul 2024 17:56:19 +0400 Subject: [PATCH] add delete calss doc --- .../video/docusaurus/docs/api/gdpr/calls.mdx | 75 +++++++++++++++++-- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/docusaurus/video/docusaurus/docs/api/gdpr/calls.mdx b/docusaurus/video/docusaurus/docs/api/gdpr/calls.mdx index c4af6f24..05d80547 100644 --- a/docusaurus/video/docusaurus/docs/api/gdpr/calls.mdx +++ b/docusaurus/video/docusaurus/docs/api/gdpr/calls.mdx @@ -9,13 +9,13 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## Calls deletion +## Delete a call You can either soft-delete or hard-delete a call and all its related data (members, sessions, recordings, transcriptions). ### Soft delete -Soft-delete a call means that the call and all its related data will not be completely removed from our system but will no longer be accessible via the API. +Soft-deleting a call means that the call and all its related data will not be completely removed from our system but will no longer be accessible via the API. @@ -50,14 +50,14 @@ curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${C :::note -_This endpoint requires a server-side authentication._ +_This endpoint requires server-side authentication._ ::: -Hard-delete a call means that the call and all its related data will be completely wiped out from our system. +Hard-deleting a call means that the call and all its related data will be completely wiped out from our system. This action is irrevocable, and the data cannot be recovered. -This operation is done asynchronously and you can use the returned `task_id` to monitor its progress. +This operation is done asynchronously, and you can use the returned `task_id` to monitor its progress. See [how to monitor an async task](../../misc/async). @@ -88,3 +88,68 @@ curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${C + + +## Delete many calls + +:::note + +_This endpoint requires server-side authentication._ + +::: + +If you have more than one call to delete, you can use the batch endpoint, which allows you to delete up to 100 calls in one API call. + + + + + +```js +// hard-delete calls +const resp = await client.deleteCalls({ + cids: ["cid1", "cid2", "cid3"], + hard: true, +}); +// resp.task_id is the ID to be used for monitoring the task +``` + + + + +```bash +# Hard-delete calls +curl -X POST "https://video.stream-io-api.com/api/v2/video/calls/delete?api_key=${API_KEY}" \ + -H "Authorization: ${TOKEN}" \ + -H "stream-auth-type: jwt" \ + -H "Content-Type: application/json" \ + -d '{ + "cids": ["cid1", "cid2", "cid3"] + "hard": true + }' +``` + + + + + +The main difference with the single call deletion endpoint is that the actual deletion will be done asynchronously, whether or not the `hard` paremeter is true. + +When the operation is done, the [GetTask endpoint](../../misc/async) returns a map in the `result` field, which provides information about the success or failure of each deletion. +```js +// example of the result field +{ + "cid1": { + "status": "ok", + }, + "cid2": { + "status": "error", + "error": "something wrong happened, please retry" + } + "cid3": { + "status": "error", + "error": "call not found" + } +} +``` + +In the snippet above, we can see that `cid2` and `cid3` failed to be deleted. `cid3` doesn't exist so there is nothing to do; however, we can make another API call to delete `cid2`.