To upload tiktok video document specify this curl command. However, my code below with the video path in the post body does not look like the correct way to handle it. What is the best way to convert this curl to HttpClient logic?
curl –location –request PUT ‘https://open-upload.tiktokapis.com/video/?upload_id=67890&upload_token=Xza123’
–header ‘Content-Range: bytes 0-30567099/30567100’
–header ‘Content-Type: video/mp4’
–data ‘@/path/to/file/example.mp4’
HttpClient client = new HttpClient();
request = new HttpRequestMessage(HttpMethod.Put, uploadInfo.data.upload_url);
request.Method = HttpMethod.Put;
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content =
new StringContent(vidPath);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("video/mp4");
request.Content.Headers.ContentLength = vidSize;
request.Content.Headers.ContentRange = new ContentRangeHeaderValue(0, vidSize);
response = await client.SendAsync(request);
The Error
SocketException: An existing connection was forcibly closed by the remote host.