[Solved] How do I delete a video in my Vimeo account?


The following works if you have a Vimeo account (at least it works at the Plus level and above) and have created an app, given that app permission to delete, gotten an access token for that app, and have a video number for the video you want to delete.

Within a class put the following code:

HttpClient httpClient = new HttpClient();


    public async Task deleteVideo(string videoNumber, string accessToken) 
    {

        try
        {

            string vimeoApiUrl = "https://api.vimeo.com/videos/" + videoNumber; // Vimeo URL


            var body = "{}";

            HttpContent content = new StringContent(body);

            using (var requestMessage = new HttpRequestMessage(HttpMethod.Delete, vimeoApiUrl))
            {
                requestMessage.Headers.Authorization =
                    new AuthenticationHeaderValue("Bearer", accessToken);
                requestMessage.Headers.Add("Accept", "application/vnd.vimeo.*+json;version=3.4");
                requestMessage.Headers.Add("ContentType", "application/x-www-form-urlencoded");
                requestMessage.Content = content;
                var response = await httpClient.SendAsync(requestMessage).ConfigureAwait(false);

                response.EnsureSuccessStatusCode();
            }

        }
        catch (Exception err)
        {
            var errMessage = err.Message;
            Console.WriteLine("In deleteVideo() error: " + err.Message);
        }

    }

To call it from within that class:

await deleteVideo(videoNumber, accessToken).ConfigureAwait(false);

solved How do I delete a video in my Vimeo account?