# 2. Upload Video: {Location} PUT https://graph.facebook.com/upload/youtube/v3/videos Content-Type: application/octet-stream Reference: https://docs.deao.dev/cloudflare/social-media-posting/you-tube/2-upload-video-location ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: collection version: 1.0.0 paths: /upload/youtube/v3/videos: put: operationId: 2-upload-video-location summary: '2. Upload Video: {Location}' tags: - subpackage_socialMediaPosting.subpackage_socialMediaPosting/youTube parameters: - name: part in: query required: false schema: type: string - name: uploadType in: query required: false schema: type: string - name: upload_id in: query required: false schema: type: string - name: Content-Range in: header description: bytes {start}-{end}-1/{x_upload_content_length} required: false schema: type: string - name: '' in: header description: Chunks of 128mb required: false schema: type: string responses: '200': description: OK content: application/json: schema: $ref: >- #/components/schemas/Social Media Posting_YouTube_2. Upload Video: {Location}_Response_200 requestBody: content: application/octet-stream: schema: type: string format: binary servers: - url: https://graph.facebook.com - url: https://www.youtube.com - url: https://youtube-video-summarizer-gpt-ai.p.rapidapi.com - url: https://api.cloudflare.com - url: https://dev-musiccast.odoo.com - url: https://api.search.brave.com - url: https://og-image-generator-dev.deao.workers.dev - url: https://musiccast.odoo.com - url: https://m.musicca.st - url: https://api.stripe.com - url: https://api.kie.ai - url: https://api.pexels.com - url: https://api.shotstack.io - url: https://oauth2.googleapis.com - url: https://www.googleapis.com - url: https://api.linkedin.com - url: https://www.linkedin.com - url: https://rupload.facebook.com - url: https://api.x.com - url: https://open.tiktokapis.com - url: https://open-upload-sg.tiktokapis.com - url: https://social-media-posting-dev.deao.workers.dev components: schemas: UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaStatus: type: object properties: license: type: string embeddable: type: boolean uploadStatus: type: string privacyStatus: type: string publicStatsViewable: type: boolean required: - license - embeddable - uploadStatus - privacyStatus - publicStatsViewable title: UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaStatus UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetLocalized: type: object properties: title: type: string description: type: string required: - title - description title: >- UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetLocalized UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsHigh: type: object properties: url: type: string format: uri width: type: integer height: type: integer required: - url - width - height title: >- UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsHigh UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsMedium: type: object properties: url: type: string format: uri width: type: integer height: type: integer required: - url - width - height title: >- UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsMedium UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsDefault: type: object properties: url: type: string format: uri width: type: integer height: type: integer required: - url - width - height title: >- UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsDefault UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnails: type: object properties: high: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsHigh medium: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsMedium default: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnailsDefault required: - high - medium - default title: >- UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnails UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippet: type: object properties: title: type: string channelId: type: string localized: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetLocalized categoryId: type: string thumbnails: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippetThumbnails description: type: string publishedAt: type: string format: date-time channelTitle: type: string liveBroadcastContent: type: string required: - title - channelId - localized - categoryId - thumbnails - description - publishedAt - channelTitle - liveBroadcastContent title: UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippet 'Social Media Posting_YouTube_2. Upload Video: {Location}_Response_200': type: object properties: id: type: string etag: type: string kind: type: string status: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaStatus snippet: $ref: >- #/components/schemas/UploadYoutubeV3VideosPutResponsesContentApplicationJsonSchemaSnippet required: - id - etag - kind - status - snippet title: 'Social Media Posting_YouTube_2. Upload Video: {Location}_Response_200' ``` ## SDK Code Examples ```python Social Media Posting_YouTube_2. Upload Video: {Location}_example import requests url = "https://graph.facebook.com/upload/youtube/v3/videos" querystring = {"part":"snippet,status","uploadType":"resumable","upload_id":"AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY"} headers = { "Content-Range": "bytes 4194304-7420639/7420640", "Content-Type": "application/octet-stream" } response = requests.put(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript Social Media Posting_YouTube_2. Upload Video: {Location}_example const url = 'https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY'; const options = { method: 'PUT', headers: { 'Content-Range': 'bytes 4194304-7420639/7420640', 'Content-Type': 'application/octet-stream' } }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Social Media Posting_YouTube_2. Upload Video: {Location}_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY" req, _ := http.NewRequest("PUT", url, nil) req.Header.Add("Content-Range", "bytes 4194304-7420639/7420640") req.Header.Add("Content-Type", "application/octet-stream") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Social Media Posting_YouTube_2. Upload Video: {Location}_example require 'uri' require 'net/http' url = URI("https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Content-Range"] = 'bytes 4194304-7420639/7420640' request["Content-Type"] = 'application/octet-stream' response = http.request(request) puts response.read_body ``` ```java Social Media Posting_YouTube_2. Upload Video: {Location}_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY") .header("Content-Range", "bytes 4194304-7420639/7420640") .header("Content-Type", "application/octet-stream") .asString(); ``` ```php Social Media Posting_YouTube_2. Upload Video: {Location}_example request('PUT', 'https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY', [ 'headers' => [ 'Content-Range' => 'bytes 4194304-7420639/7420640', 'Content-Type' => 'application/octet-stream', ], ]); echo $response->getBody(); ``` ```csharp Social Media Posting_YouTube_2. Upload Video: {Location}_example using RestSharp; var client = new RestClient("https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY"); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Range", "bytes 4194304-7420639/7420640"); request.AddHeader("Content-Type", "application/octet-stream"); IRestResponse response = client.Execute(request); ``` ```swift Social Media Posting_YouTube_2. Upload Video: {Location}_example import Foundation let headers = [ "Content-Range": "bytes 4194304-7420639/7420640", "Content-Type": "application/octet-stream" ] let request = NSMutableURLRequest(url: NSURL(string: "https://graph.facebook.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable&upload_id=AGQBYWxevNusOCBRP_m1xn_UDGa3-OZ1CAAFrObtsn2FrimfpKLjfMGr50FdFKtB92DUBhQ6KGdNo8hN9-6DwfzBPnnR3KgjlhilgxF3BALL8XY")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```