From c17d8f2e4e49a649253ec3db7d262070ede1ca0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=BCbeyde=20Civelek?= Date: Wed, 4 Dec 2024 11:21:50 +0100 Subject: [PATCH] Apply suggestions from code review --- ...Collection - CDS Videos Publish Video.json | 38 +++----- README.rst | 89 ++++++++++--------- 2 files changed, 61 insertions(+), 66 deletions(-) diff --git a/Bruno Collection - CDS Videos Publish Video.json b/Bruno Collection - CDS Videos Publish Video.json index f49531916..ebd58d7f1 100644 --- a/Bruno Collection - CDS Videos Publish Video.json +++ b/Bruno Collection - CDS Videos Publish Video.json @@ -7,7 +7,7 @@ "name": "Optional Change access of the video", "seq": 8, "request": { - "url": "{{baseURl}}/api/deposits/video/{{video_id}}", + "url": "{{baseURL}}/api/deposits/video/{{video_id}}", "method": "PUT", "headers": [ { @@ -19,7 +19,7 @@ "params": [], "body": { "mode": "json", - "json": "{\n \"_access\": {\n \"update\": [\n \"admin@test.ch\",\n \"atlas-outreach-cds-video@cern.ch\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"atlas-readaccess-active-members@cern.ch\"\n ]\n\n }\n}\n\n", + "json": "{\n \"_access\": {\n \"update\": [\n \"admin@test.ch\",\n \"your-egroup@cern.ch\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"your-egroup@cern.ch\"\n ]\n\n }\n}\n\n", "formUrlEncoded": [], "multipartForm": [] }, @@ -37,7 +37,7 @@ "name": "Get project to check the flow is finished", "seq": 5, "request": { - "url": "{{baseURl}}/api/deposits/project/{{project_id}}", + "url": "{{baseURL}}/api/deposits/project/{{project_id}}", "method": "GET", "headers": [ { @@ -67,7 +67,7 @@ "name": "Step 1- Create a project", "seq": 1, "request": { - "url": "{{baseURl}}/api/deposits/project/", + "url": "{{baseURL}}/api/deposits/project/", "method": "POST", "headers": [ { @@ -79,7 +79,7 @@ "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 \"admin@test.ch\",\n \"atlas-outreach-cds-video@cern.ch\"\n ],\n \"read\": [ // If you want to restrict the project, add access read\n \"atlas-readaccess-active-members@cern.ch\"\n ]\n },\n // Add category and type\n \"category\": \"ATLAS\",\n \"type\": \"VIDEO\"\n}", + "json": "{\n \"$schema\": \"https://localhost:5000/schemas/deposits/records/videos/project/project-v1.0.0.json\",\n \"_access\": {\n \"update\": [\n \"admin@test.ch\",\n \"your-egroup@cern.ch\"\n ],\n \"read\": [ // If you want to restrict the project, add access read\n \"your-egroup@cern.ch\"\n ]\n },\n // Add category and type\n \"category\": \"ATLAS\",\n \"type\": \"VIDEO\"\n}", "formUrlEncoded": [], "multipartForm": [] }, @@ -99,7 +99,7 @@ "name": "Step 2- Create a video", "seq": 2, "request": { - "url": "{{baseURl}}/api/deposits/video/", + "url": "{{baseURL}}/api/deposits/video/", "method": "POST", "headers": [ { @@ -111,7 +111,7 @@ "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\": \"zubeyde.civelek@cern.ch\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\"\n}", + "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\": \"test@cern.ch\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\"\n}", "formUrlEncoded": [], "multipartForm": [] }, @@ -131,7 +131,7 @@ "name": "Step 3- Upload the video", "seq": 3, "request": { - "url": "{{baseURl}}/api/files/{{bucket_id}}/{{video_name}}", + "url": "{{baseURL}}/api/files/{{bucket_id}}/{{video_name}}", "method": "PUT", "headers": [ { @@ -151,20 +151,6 @@ } ], "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);" @@ -182,7 +168,7 @@ "name": "Step 4- Create a flow", "seq": 4, "request": { - "url": "{{baseURl}}/api/flows/", + "url": "{{baseURL}}/api/flows/", "method": "POST", "headers": [ { @@ -212,7 +198,7 @@ "name": "Step 5- Upload additional file", "seq": 6, "request": { - "url": "{{baseURl}}/api/files/{{bucket_id}}/{{additional_file}}", + "url": "{{baseURL}}/api/files/{{bucket_id}}/{{additional_file}}", "method": "PUT", "headers": [], "params": [], @@ -238,7 +224,7 @@ "name": "Step 6- Publish", "seq": 7, "request": { - "url": "{{baseURl}}/api/deposits/video/{{video_id}}/actions/publish", + "url": "{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish", "method": "POST", "headers": [ { @@ -269,7 +255,7 @@ { "variables": [ { - "name": "baseURl", + "name": "baseURL", "value": "https://localhost:5000/", "enabled": true, "secret": false, diff --git a/README.rst b/README.rst index 54b8106e1..28204232e 100644 --- a/README.rst +++ b/README.rst @@ -26,9 +26,9 @@ Table of Contents - `Step 3: Upload the Video <#step-3-upload-the-video>`_ - `Step 4: Create a Flow <#step-4-create-a-flow>`_ - `Step 5: (Optional) Upload Additional File <#step-5-optional-upload-additional-file>`_ - - `Step 6: Publish Video <#step-6-publish-video>`_ - `Optional: Update the Access of the Video <#optional-update-the-access-of-the-video>`_ - - `Optional: Get Project Status <#optional-get-project-status>`_ + - `Step 6: Get Project to Check the Flow Status <#step-6-get-project-to-check-the-flow-status>`_ + - `Step 7: Publish Video <#step-7-publish-video>`_ - `License <#license>`_ @@ -186,7 +186,7 @@ Generate a Personal Access Token --------------------------------- - Navigate to the ``CDS Videos`` platform. -- Click your user info in the top-right corner. +- Click on your user info in the top-right corner. - Go to **Applications** and create a new **Personal Access Token**. - Copy the token and store it securely. @@ -286,10 +286,10 @@ To restrict the project, add ``_access/read``: "_access": { "update": [ "admin@test.ch", - "atlas-outreach-cds-video@cern.ch" + "your-egroup@cern.ch" ], "read": [ - "atlas-readaccess-active-members@cern.ch" + "your-egroup@cern.ch" ] }, "category": "ATLAS", @@ -377,7 +377,7 @@ Step 2: Create a Video * - **vr** - boolean - body - - + - Indicates if the video is 360. - Optional * - **contributors** - array @@ -402,7 +402,7 @@ Step 2: Create a Video * - **featured** - boolean - body - - Whether the video is featured. + - Whether the video is featured. (Available for members of `VIDEOS_EOS_PATH_EGROUPS <./cds/config.py#L1277>`_) - Optional * - **keywords** - list @@ -428,6 +428,11 @@ To restrict the video, add ``_access/read``. The ``_access/update`` will be the { "title":"217490_medium" }, + "_access": { + "read": [ + "your-egroup@cern.ch" + ] + }, "vr": false, "featured": false, "language": "en", @@ -600,35 +605,6 @@ Step 5: (Optional) Upload Additional File Uploaded additional file JSON. -Step 6: Publish Video ----------------------- - -**Request:** - -``POST`` ``{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish`` - -**Headers:** - -- ``content-type: application/json`` - -**Parameters:** - -.. list-table:: - :header-rows: 1 - - * - **Name** - - **Type** - - **Location** - - **Description** - * - **video_id** - - string - - path - - ID of the video to publish. - - -**Response:** - -Published video deposit JSON. Optional: Update the Access of the Video ---------------------------------------- @@ -665,10 +641,10 @@ To restrict the video, add ``_access/read``. If you want to change the access/up "_access": { "update": [ "admin@test.ch", - "atlas-outreach-cds-video@cern.ch" + "your-egroup@cern.ch" ], "read": [ - "atlas-readaccess-active-members@cern.ch" + "your-egroup@cern.ch" ] } } @@ -678,8 +654,8 @@ To restrict the video, add ``_access/read``. If you want to change the access/up Updated video JSON. -Optional: Get Project Status ---------------------------- +Step 6: Get Project to Check the Flow Status +-------------------------------------------- **Request:** @@ -721,6 +697,39 @@ Updated project JSON with flow status as ``state``: } +Step 7: Publish Video +---------------------- + +Before publishing the video, ensure that the workflow is complete. + +**Request:** + +``POST`` ``{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish`` + +**Headers:** + +- ``content-type: application/json`` + +**Parameters:** + +.. list-table:: + :header-rows: 1 + + * - **Name** + - **Type** + - **Location** + - **Description** + * - **video_id** + - string + - path + - ID of the video to publish. + + +**Response:** + +Published video deposit JSON. + + License =======