Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README and Add Bruno Collection for REST APIs #1988

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions Bruno Collection - CDS Videos Publish Video.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
{
"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\": \"Surname, Name\",\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": [],
"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"
]
}
}
Loading
Loading