Uploading video to PeerTube via API "Schedule At" error

Hello everyone, recently I’ve been trying to upload video to my PeerTube instance and faced a problem: updateAt parameter is not recognised by the server at all.
I am using JSON.stringify to send an object to the server, maybe it is not a correct way to operate with this API? Content-type is automatically set to ‹ multipart/form-data › since I am using FormData object to create the body of my server call.

Also, why this parameter is mandatory anyway? It even does not mention in the example on the API page.

Thanks for your attention.

API link: https://docs.joinpeertube.org/api-rest-reference.html#tag/Video/paths/~1videos~1upload/post

Hello,

scheduleUpdate is optional, but if you specify it scheduleUpdate.updateAt is mandatory.

If you want to specify it, you should not use stringify. Instead, use the plain text value using scheduleUpdate[updateAt] and scheduleUpdate[privacy] parameters.

1 « J'aime »

Thanks for the fast response! It is working now in a way - I am getting 500 error from the server, as when I am not using scheduleUpdate parameter. Could you please explain, what is a proper way to send binary file to server? Currently I am doing it like this:

const videoInputFile = wnd.find('.upload-video-file').prop('files')[0]; // getting video file from input
const bodyOfQuery = {
            privacy : 1,
            channelId : channelInfo.id,
            name : `${this.userName}:${new Date().toISOString()}`,
            videofile : videoInputFile.slice(0),
        }

const formData = new FormData();

Object.keys(bodyOfQuery).map(key => formData.append(key, bodyOfQuery[key]));

And this formdata object is passed to fetch call

It turned out, that slice(0) is redundant.