Http request node - How to Upload media body and body parameter?

Hello,

I am trying to build a workflow that automatically translates YouTube captions to another language. Thanks to this post, I found a way to download the caption.

Now I am trying to upload them using the Youtube API v3 caption endpoint.

I need to pass several parameters in the body. So, I chose JSON and am using JSON. But this endpoint also requires a media file.

I searched a lot and did not find a way to do this with the HTTP request node. Is it something possible to do? Thanks a lot for your help.

Best regards, the n8ninja

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

You will need to use the Form-Data type. There you will be able to set both the binary data and the json.

Thanks a lot.
I investigated using Form-Data, and indeed, I can provide the binary and some metadata, but I cannot manage to make it work.

If I chose the form-data, no matter how I format the input, it is not accepted and I receive the error that β€œthe request contains invalid metadata values, which prevent the track from being created.”

This is tricky, the Youtube API is not well documented, and I found no body on the internet who tried to upload captions programmatically using regular HTTP requests.

I found a bunch of video where they are using the YT PHP api for instance, but this is not what I want, my goal would be to have this working in a n8n workflow, without the need to deploy an external function.

If someone, more expert than me in managing the HTTP node, could check, I would highly appreciate ! I think that a workflow that could help with uploading YT captions could bring a lot of value.

Here is the caption API : Captions: insert  |  YouTube Data API  |  Google for Developers

Here is my latest try :

I am following up on this because the challenge I face is not directly related to n8n, but more about how to set up the HTTP request with both the file and metadata.

I asked on Stack Overflow: http - How to upload caption to Youtube using rest API - Stack Overflow

I will post the answer here when I find the solution. :slight_smile:

1 Like