0

I'm trying to upload a video using the post request shown in the Google API explorer, but I keep getting a 400 error: Request contains an invalid argument. This error even happens with the test version that automatically populates all of the fields on the API explorer.

I've successfully used the YouTube api to upload videos in node js but whenever I try to do it in HTML for a different project that I'm working on I keep getting the error. I'm not sure if it's because I'm not including the video binary, but whenever I try that I still get the error.

From my initial understanding, I thought that you needed to make a post request with JSON of the metadata, recieve an upload url as a response, and then do a put request to that url with the video data. I'm at the point where I can create "videoless videos" in my channel content, but can't upload the video in the put request as I'm getting that 400 error "Request contains an invalid argument" in my initial metadata post request. "videoless videos" The "videoless videos" reflect the options that I chose in the json including the title and description being "Test video upload postman". This is the JSON I sent

{
  "snippet": {
    "categoryId": "22",
    "description": "Test video upload postman.",
    "title": "Test video upload postman."
  },
  "status": {
    "privacyStatus": "private",
    "embeddable": true
  }
}

I've tried only uploading the video binary and not including anything about the metadata, using Content-Type: video/mp4 and Accept: video/mp4 but that results in 400 error: "Invalid JSON payload received. Expected a value."

If I still can't get this to work in the future, I might be able to use the youtube API package, but a fully fleshed example of an HTML request to upload video and metadata would be much appreciated, thank you!

0

Browse other questions tagged or ask your own question.