Chia sẻ code Import Postman giúp test chức năng gọi API upload Facebook Reels.
  {
	"info": {
		"_postman_id": "ac4261d5-77f5-4dcc-b96e-35bf18c01873",
		"name": "Facebook Reels Publishing API",
		"description": "This collection allows developers to upload and publish a Reel into a Facebook page from a local file or CDN.\n\n**Supported video formats:** `3g2`, `3gp`, `3gpp`, `asf`, `avi`, `dat`, `divx`, `dv`, `f4v`, `flv`, `m2ts`, `m4v`, `mkv`, `mod`, `mov`, `mp4`, `mpe`, `mpeg`, `mpeg4`, `mpg`, `mts`, `nsv`, `ogm`, `ogv`, `qt`, `tod`, `ts`, `vob`, `wmv`.\n\n**Video requirements:**\n\n| Property | Min (or n/a) | Max (or n/a) |\n| --- | --- | --- |\n|   <br>  <br>Resolution  <br>  <br> |   <br>  <br>540 x 960 (540p)  <br>  <br> |   <br>  <br>n/a  <br>  <br> |\n|   <br>  <br>Aspect Ratio  <br>  <br> |   <br>  <br>9x16  <br>  <br> |   <br>  <br>9x16  <br>  <br> |\n|   <br>  <br>Frame Rate  <br>  <br> |   <br>  <br>23  <br>  <br> |   <br>  <br>n/a  <br>  <br> |\n|   <br>  <br>Duration  <br>  <br> |   <br>  <br>4 sec  <br>  <br> |   <br>  <br>60 sec  <br>  <br> |\n|   <br>  <br>File Size  <br>  <br> |   <br>  <br>n/a  <br>  <br> |   <br>  <br>n/a  <br>  <br> |",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "19667706"
	},
	"item": [
		{
			"name": "1. Create Reel",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"if (pm.response.code==200)",
							"{",
							"    var jsonData = JSON.parse(responseBody);",
							"    postman.setEnvironmentVariable(\"video_id\", jsonData.video_id);",
							"}",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [],
				"url": {
					"raw": "https://graph.facebook.com/v13.0/me/video_reels?access_token={{access_token}}&upload_phase=start",
					"protocol": "https",
					"host": [
						"graph",
						"facebook",
						"com"
					],
					"path": [
						"v13.0",
						"me",
						"video_reels"
					],
					"query": [
						{
							"key": "access_token",
							"value": "{{access_token}}",
							"description": "Page Access Token"
						},
						{
							"key": "upload_phase",
							"value": "start",
							"description": "Signal to initialize a new upload phase"
						}
					]
				},
				"description": "This request initializes a video upload session. When successful the API response includes a **video_id** that will be used in subsequent calls as the identifier for our Reel in the upload, status and publish steps."
			},
			"response": []
		},
		{
			"name": "2.A Upload Local Reel",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"protocolProfileBehavior": {
				"disabledSystemHeaders": {
					"content-type": true
				}
			},
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "OAuth {{access_token}}",
						"type": "text"
					},
					{
						"key": "offset",
						"value": "0",
						"description": "In case of resumable upload, replace this with the offset returned by /status",
						"type": "text"
					},
					{
						"key": "file_size",
						"value": "0",
						"description": "Replace with your local video file size",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/octet-stream",
						"type": "text"
					}
				],
				"body": {
					"mode": "file",
					"file": {
						"src": ""
					}
				},
				"url": {
					"raw": "https://rupload.facebook.com/video-upload/v13.0/{{video_id}}",
					"protocol": "https",
					"host": [
						"rupload",
						"facebook",
						"com"
					],
					"path": [
						"video-upload",
						"v13.0",
						"{{video_id}}"
					]
				},
				"description": "This method is used when the video source is a local file. The video must be included in the request body as a data binary and its file size in bytes must be included in the **file_size** header."
			},
			"response": []
		},
		{
			"name": "2.B Upload Hosted Reel",
			"protocolProfileBehavior": {
				"disabledSystemHeaders": {
					"content-type": true
				}
			},
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "OAuth {{access_token}}",
						"type": "text"
					},
					{
						"key": "file_url",
						"value": "",
						"type": "text",
						"description": "Replace with your own web hosted video URL"
					}
				],
				"url": {
					"raw": "https://rupload.facebook.com/video-upload/v13.0/{{video_id}}",
					"protocol": "https",
					"host": [
						"rupload",
						"facebook",
						"com"
					],
					"path": [
						"video-upload",
						"v13.0",
						"{{video_id}}"
					]
				},
				"description": "This method is used when the video source is hosted on a CDN. The video link must be included in the **file_url** header."
			},
			"response": []
		},
		{
			"name": "3. (Optional) Get upload session status",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "https://graph.facebook.com/v13.0/{{video_id}}?fields=status&access_token={{access_token}}",
					"protocol": "https",
					"host": [
						"graph",
						"facebook",
						"com"
					],
					"path": [
						"v13.0",
						"{{video_id}}"
					],
					"query": [
						{
							"key": "fields",
							"value": "status"
						},
						{
							"key": "access_token",
							"value": "{{access_token}}"
						}
					]
				},
				"description": "Retrieves the status of the Reels publishing operation composed of three steps, uploading, processing and publishing."
			},
			"response": []
		},
		{
			"name": "4. Publish Reel",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [],
				"url": {
					"raw": "https://graph.facebook.com/v13.0/me/video_reels?access_token={{access_token}}&video_id={{video_id}}&upload_phase=finish&video_state=PUBLISHED&description=Description text goes here&title=Title goes here",
					"protocol": "https",
					"host": [
						"graph",
						"facebook",
						"com"
					],
					"path": [
						"v13.0",
						"me",
						"video_reels"
					],
					"query": [
						{
							"key": "access_token",
							"value": "{{access_token}}"
						},
						{
							"key": "video_id",
							"value": "{{video_id}}"
						},
						{
							"key": "upload_phase",
							"value": "finish",
							"description": "Signal to finish the upload phase"
						},
						{
							"key": "video_state",
							"value": "PUBLISHED",
							"description": "Possible values: DRAFT, SCHEDULED, PUBLISHED"
						},
						{
							"key": "description",
							"value": "Description text goes here",
							"description": "Optional"
						},
						{
							"key": "title",
							"value": "Title goes here",
							"description": "Optional"
						}
					]
				},
				"description": "Ends the upload phase to start assembling and encoding the video. You can also customize the reel with the optional parameters."
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "video_id",
			"value": ""
		}
	]
}