title: Deleting a video from a playlist with YouTube Data API v3 in Google Apps Script
body: <p><strong>Question</strong>: How to use <a href="https://developers.google.com/youtube/v3/docs/playlistItems/delete" rel="nofollow">delete</a> of playlistItems in Google Apps Script?</p>
  
  <hr>
  
  <p><strong>What I tried:</strong> </p>
  
  <ol>
  <li>All these give
  <code>Missing name after . operator. (line 123, file "Code")</code> error (I have a sense it might be related to JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete" rel="nofollow">delete</a> operator, not sure.):</li>
  </ol>
  
  <p><code>YouTube.PlaylistItems.delete()</code>
  <code>YouTube.PlaylistItems.delete("PLi22jkbHFzDjQNWcy4qfLamNjyb0nvkq8")</code>
  <code>YouTube.PlaylistItems.delete({id: "PLi22jkbHFzDjQNWcy4qfLamNjyb0nvkq8"})</code></p>
  
  <ol start="2">
  <li>Apparently, executes fine, but no effect:</li>
  </ol>
  
  <pre>
    var payload =
        {
          "id" : "PLi22jkbHFzDjQNWcy4qfLamNjyb0nvkq8",
        };
  
    var options =
        {
          "method" : "delete",
          "payload" : payload
        };
  
    Logger.log(UrlFetchApp.fetch("https://www.googleapis.com/youtube/v3/playlistItems", options));
  </pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <hr>
  
  <p><strong>Extra details.</strong> The thing I want to do is clear all of the items in a playlist and I already have the following code:</p>
  
  <pre><code>  var result = YouTube.PlaylistItems.list('id', {
      playlistId: "2L1YG9ktx9sVdo-PMFD2iwCC-UWmkYrgQ-"
    });
  
    Logger.log(result.items.length);
  
    var items = result.items;
  
    for (var i = 0; i &lt; items.length; i++) {
      Logger.log(items[i].id);
      // Deletion of the item with id of "items[i].id is expected to happen here
    }
  </code></pre>