-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec9b0d6
commit 333c02b
Showing
2 changed files
with
447 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,306 @@ | ||
{ | ||
"name": "CDS Videos Publish Video", | ||
"version": "1", | ||
"items": [ | ||
{ | ||
"type": "http", | ||
"name": "Optional Change access of the video", | ||
"seq": 8, | ||
"request": { | ||
"url": "{{baseURl}}/api/deposits/video/{{video_id}}", | ||
"method": "PUT", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.video.partial+json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "{\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"[email protected]\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"[email protected]\"\n ]\n\n }\n}\n\n", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": {}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Get project to check the flow is finished", | ||
"seq": 5, | ||
"request": { | ||
"url": "{{baseURl}}/api/deposits/project/{{project_id}}", | ||
"method": "GET", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.project.partial+json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": {}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 1- Create a project", | ||
"seq": 1, | ||
"request": { | ||
"url": "{{baseURl}}/api/deposits/project/", | ||
"method": "POST", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.project.partial+json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "{\n \"$schema\": \"https://localhost:5000/schemas/deposits/records/videos/project/project-v1.0.0.json\",\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"read\": [ // If you want to restrict the project, add access read\n \"[email protected]\"\n ]\n },\n // Add category and type\n \"category\": \"ATLAS\",\n \"type\": \"VIDEO\"\n}", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": { | ||
"res": "let data = res.body ;\nbru.setEnvVar(\"project_id\", data.id);" | ||
}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 2- Create a video", | ||
"seq": 2, | ||
"request": { | ||
"url": "{{baseURl}}/api/deposits/video/", | ||
"method": "POST", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.video.partial+json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "{\n \"$schema\":\"https://localhost:5000/schemas/deposits/records/videos/video/video-v1.0.0.json\",\n \"_project_id\":\"{{project_id}}\",\n \"title\":\n {\n \"title\":\"217490_medium\"\n },\n\n \"vr\": false,\n \"featured\": false,\n \"language\": \"en\",\n \"contributors\": [\n {\n \"name\": \"Civelek, Zubeyde\",\n \"ids\": [\n {\n \"value\": \"868056\",\n \"source\": \"cern\"\n }\n ],\n \"email\": \"[email protected]\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\"\n}", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": { | ||
"res": "let data = res.body ;\nbru.setEnvVar(\"video_id\", data.id);\nbru.setEnvVar(\"bucket_id\", data.metadata._buckets.deposit);\n" | ||
}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 3- Upload the video", | ||
"seq": 3, | ||
"request": { | ||
"url": "{{baseURl}}/api/files/{{bucket_id}}/{{video_name}}", | ||
"method": "PUT", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "video/mp4", | ||
"enabled": true | ||
}, | ||
{ | ||
"name": "Accept", | ||
"value": "application/json, text/plain, */*", | ||
"enabled": true | ||
}, | ||
{ | ||
"name": "Accept-Encoding", | ||
"value": "gzip, deflate, br, zstd", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "formUrlEncoded", | ||
"formUrlEncoded": [], | ||
"multipartForm": [ | ||
{ | ||
"type": "file", | ||
"name": "", | ||
"value": [ | ||
"/Users/zubeydecivelek/Downloads/217490_medium.mp4" | ||
], | ||
"enabled": true | ||
} | ||
] | ||
}, | ||
"script": { | ||
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"CHANGE HERE\";\nconst filePath = \"CHANGE HERE\";\nbru.setEnvVar(\"video_name\",filename);\n\n// Read the file as raw binary data\nconst fileContent = fs.readFileSync(filePath);\n\n// Set request headers\nreq.setHeader(\"Content-Type\", \"video/mp4\"); // File content type\nreq.setHeader(\"Accept\", \"application/json, text/plain, */*\"); \nreq.setHeader(\"Accept-Encoding\", \"gzip, deflate, br, zstd\"); \nreq.setHeader(\"Content-Length\", fileContent.length);\n\n// Attach the file content as the request body\nreq.setBody(fileContent);\n", | ||
"res": "let data = res.body ;\nbru.setEnvVar(\"main_file_version_id\", data.version_id);\nbru.setEnvVar(\"video_key\", data.key);" | ||
}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 4- Create a flow", | ||
"seq": 4, | ||
"request": { | ||
"url": "{{baseURl}}/api/flows/", | ||
"method": "POST", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.project.partial+json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "{\n \"version_id\":\"{{main_file_version_id}}\", //response of the put the video 'version_id' \n \"key\": \"{{video_key}}\",//response of the put the video 'key' \n \"bucket_id\":\"{{bucket_id}}\", // create video response \n \"deposit_id\":\"{{video_id}}\" // create video response\n}", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": {}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 5- Upload additional file", | ||
"seq": 6, | ||
"request": { | ||
"url": "{{baseURl}}/api/files/{{bucket_id}}/{{additional_file}}", | ||
"method": "PUT", | ||
"headers": [], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": { | ||
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"CHANGE HERE\";\nconst filePath = \"CHANGE HERE\";\nbru.setEnvVar(\"additional_file\", filename);\n\n// Read the file as raw binary data\nconst fileContent = fs.readFileSync(filePath);\n\n// Set request headers\nreq.setHeader(\"Accept\", \"application/json, text/plain, */*\"); \nreq.setHeader(\"Accept-Encoding\", \"gzip, deflate, br, zstd\"); \nreq.setHeader(\"Content-Length\", fileContent.length);\n\n// Attach the file content as the request body\nreq.setBody(fileContent);\n" | ||
}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "Step 6- Publish", | ||
"seq": 7, | ||
"request": { | ||
"url": "{{baseURl}}/api/deposits/video/{{video_id}}/actions/publish", | ||
"method": "POST", | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json", | ||
"enabled": true | ||
} | ||
], | ||
"params": [], | ||
"body": { | ||
"mode": "json", | ||
"json": "", | ||
"formUrlEncoded": [], | ||
"multipartForm": [] | ||
}, | ||
"script": {}, | ||
"vars": {}, | ||
"assertions": [], | ||
"tests": "", | ||
"auth": { | ||
"mode": "inherit" | ||
} | ||
} | ||
} | ||
], | ||
"activeEnvironmentUid": "zqLEVCQ0eIhimP48VysTg", | ||
"environments": [ | ||
{ | ||
"variables": [ | ||
{ | ||
"name": "baseURl", | ||
"value": "https://localhost:5000/", | ||
"enabled": true, | ||
"secret": false, | ||
"type": "text" | ||
} | ||
], | ||
"name": "Localhost" | ||
} | ||
], | ||
"root": { | ||
"request": { | ||
"auth": { | ||
"mode": "bearer", | ||
"bearer": { | ||
"token": "CHANGE HERE" | ||
} | ||
} | ||
} | ||
}, | ||
"brunoConfig": { | ||
"version": "1", | ||
"name": "CDS Videos Publish Video", | ||
"type": "collection", | ||
"scripts": { | ||
"filesystemAccess": { | ||
"allow": true | ||
} | ||
}, | ||
"ignore": [ | ||
"node_modules", | ||
".git" | ||
] | ||
} | ||
} |
Oops, something went wrong.