diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php deleted file mode 100644 index cb96d1e..0000000 --- a/app/Exceptions/Handler.php +++ /dev/null @@ -1,62 +0,0 @@ -, \Psr\Log\LogLevel::*> - */ - protected $levels = [ - // - ]; - - /** - * A list of the exception types that are not reported. - * - * @var array> - */ - protected $dontReport = [ - // - ]; - - /** - * A list of the inputs that are never flashed to the session on validation exceptions. - * - * @var array - */ - protected $dontFlash = [ - 'current_password', - 'password', - 'password_confirmation', - ]; - - /** - * Register the exception handling callbacks for the application. - * - * @return void - */ - public function register(): void - { - $this->reportable(function (Throwable $e) { - // - }); - } - - public function render($request, Throwable $e): \Illuminate\Http\Response|JsonResponse|Response - { - if ($e instanceof ModelNotFoundException && $request->wantsJson()) { - return response()->json(['message' => sprintf('Requested %s couldn\'t be found.', class_basename($e->getModel()))], 404); - } - - return parent::render($request, $e); - } -} diff --git a/bootstrap/app.php b/bootstrap/app.php index 5af3725..2120d90 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,10 +1,12 @@ withRouting( @@ -22,5 +24,12 @@ // }) ->withExceptions(function (Exceptions $exceptions) { - // + $exceptions->render(function (NotFoundHttpException $e, \Illuminate\Http\Request $request) { + if ($request->wantsJson() && $e->getPrevious() instanceof ModelNotFoundException) { + return response()->json([ + 'message' => + sprintf('Requested %s couldn\'t be found.', class_basename($e->getPrevious()->getModel())), + ], 404); + } + }); })->create(); diff --git a/postman.json b/postman.json index ce9d5fa..be4d415 100644 --- a/postman.json +++ b/postman.json @@ -1,17 +1,17 @@ { "info": { - "_postman_id": "a73e372b-901f-4c27-a088-4816a3e1497b", - "name": "transmorpher server", - "description": "Configuration:\n\n- create a user on Transmorpher: `php artisan create:user postman postman@example.com`\n \n- use the provided auth token and adjust the \"authToken\" variable\n \n- if you're using a domain different from \"transmorpher.test\", you will have to adjust the \"domain\" variable\n \n\nIf you want to use the collection with the already defined files, you will have to go to Settings > General > Allow reading files outside working directory, and enable the option.", + "_postman_id": "aaf95d51-4e36-45f2-bfac-27119d8e6fce", + "name": "Transmorpher Server API v1", + "description": "This file describes the Transmorpher Server API.\n\n- It includes examples for failed calls as well, until they are all covered in tests.\n- Filter for \": OK\" to only see correct API calls.\n \n\nConfiguration:\n\n- create a user on Transmorpher: `php artisan create:user postman postman@example.com http://amigor/transmorpher/notifications`\n- use the provided auth token and adjust the \"authToken\" variable\n- if you're using a domain different from \"transmorpher.test\", you will have to adjust the \"domain\" variable\n \n\nIf you want to use the collection with the already defined files, you will have to go to `Settings > General > Allow reading files outside working directory`, and enable the option.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "35989477" + "_exporter_id": "25831362" }, "item": [ { "name": "Image", "item": [ { - "name": "Reserve slot: No auth", + "name": "Reserve upload slot: No auth", "event": [ { "listen": "prerequest", @@ -19,7 +19,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -36,7 +37,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -59,17 +61,19 @@ "formdata": [ { "key": "identifier", - "value": "postmanUnusedImage", + "value": "{{imageIdentifier}}", "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/image/reserveUploadSlot", + "raw": "{{domain}}/api/v1/image/reserveUploadSlot", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "image", "reserveUploadSlot" ] @@ -78,7 +82,7 @@ "response": [] }, { - "name": "Reserve slot: Invalid identifier", + "name": "Reserve upload slot: Invalid identifier", "event": [ { "listen": "prerequest", @@ -86,7 +90,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -97,6 +102,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"identifier\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The identifier format is invalid.\",\r", @@ -108,7 +114,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -134,11 +141,13 @@ ] }, "url": { - "raw": "{{baseUrl}}/image/reserveUploadSlot", + "raw": "{{domain}}/api/v1/image/reserveUploadSlot", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "image", "reserveUploadSlot" ] @@ -147,7 +156,7 @@ "response": [] }, { - "name": "Reserve slot: OK", + "name": "Reserve upload slot: OK", "event": [ { "listen": "prerequest", @@ -155,7 +164,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -166,6 +176,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(jsonData.state).to.eql('initializing');\r", + " pm.expect(pm.response.code).to.equal(200);\r", "});\r", "/* {\r", " \"state\": 'initializing',\r", @@ -175,7 +186,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -195,21 +207,24 @@ "formdata": [ { "key": "identifier", - "value": "postmanUnusedImage", + "value": "{{imageIdentifier}}", "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/image/reserveUploadSlot", + "raw": "{{domain}}/api/v1/image/reserveUploadSlot", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "image", "reserveUploadSlot" ] - } + }, + "description": "Providing the auth token, the client reserves an upload slot for an image identifier. This action of the client backend secures the transaction, allowing the frontend to upload the image to the Transmorpher media server directly." }, "response": [] }, @@ -230,7 +245,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -239,7 +255,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -261,24 +278,24 @@ "key": "file", "type": "file", "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" + }, + { + "key": "identifier", + "value": "{{imageIdentifier}}", + "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/upload/foo", + "raw": "{{domain}}/api/v1/upload/wrongImageToken", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", - "foo" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "wrongImageToken" ] } }, @@ -295,6 +312,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"file\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The file field is required.\",\r", @@ -306,7 +324,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -323,23 +342,24 @@ ], "body": { "mode": "formdata", - "formdata": [] + "formdata": [ + { + "key": "identifier", + "value": "{{imageIdentifier}}", + "type": "text" + } + ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -356,6 +376,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"file\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The file must be a file of type: jpg, png, gif, webp.\",\r", @@ -367,7 +388,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -376,7 +398,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -407,20 +430,15 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -443,7 +461,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -452,7 +471,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/image/reserveUploadSlot\",\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/image/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -474,7 +493,8 @@ ");\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -496,24 +516,24 @@ "key": "file", "type": "file", "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" + }, + { + "key": "identifier", + "value": "{{imageIdentifier}}", + "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -530,6 +550,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"identifier\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The provided identifier does not match the identifier of the reserved upload slot.\",\r", @@ -541,7 +562,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -550,7 +572,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -571,7 +594,7 @@ { "key": "file", "type": "file", - "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" + "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" }, { "key": "identifier", @@ -581,20 +604,15 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -611,6 +629,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"identifier\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The identifier field is required.\",\r", @@ -622,7 +641,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -631,7 +651,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -652,31 +673,20 @@ { "key": "file", "type": "file", - "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" - }, - { - "key": "", - "value": "", - "type": "text", - "disabled": true + "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" } ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -693,6 +703,7 @@ " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.json().errors).to.have.property(\"identifier\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", " \"message\": \"The identifier format is invalid. (and 1 more error)\",\r", @@ -705,7 +716,8 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -714,7 +726,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -735,7 +748,7 @@ { "key": "file", "type": "file", - "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" + "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" }, { "key": "identifier", @@ -745,20 +758,15 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -774,18 +782,23 @@ "pm.test(\"Image uploaded\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData.state).to.eql('success');\r", + " pm.expect(pm.response.code).to.equal(201);\r", + " pm.collectionVariables.set('currentImageVersion', jsonData.version);\r", + " console.log('set currentImageVersion to: ' + pm.collectionVariables.get('currentImageVersion'));\r", "});\r", "/* {\r", " \"state\": 'success',\r", " \"message\": \"Successfully uploaded new image version.\",\r", " \"identifier\": \"postmanTestImage\",\r", " \"version\": 1,\r", - " \"public_path\": \"nameandemail/postmanTestImage\",\r", - " \"upload_token\": \"6464a87163b5a\"\r", + " \"public_path\": \"images/postman/postmanTestImage\",\r", + " \"upload_token\": \"6464a87163b5a\",\r", + " \"hash\": \"db36a07353dd308635fb54a5443f7277\"\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -794,7 +807,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -825,30 +839,45 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{imageUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{imageUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{imageUploadToken}}" ] - } + }, + "description": "Providing the correct upload slot token for the image identifier, the client frontend can upload the image to the Transmorpher media server. The answer of this call contains the public URL where the image will be available immediatly after upload." }, "response": [] }, { - "name": "JPG", + "name": "Download as AAA: invalid format", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Received JPG image derivative\", function() {\r", - " pm.expect(pm.response.code).to.equal(200);\r", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/jpeg\");\r", + "pm.test(\"Retrieving derivative failed: invalid format parameter\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(400);\r", "});\r", - "" + "/* {\r", + " \"message\": \"The provided value aaa for the FORMAT parameter is not valid.\"\r", + "} */" ], "type": "text/javascript", "packages": {} @@ -856,30 +885,30 @@ } ], "request": { - "auth": { - "type": "noauth" - }, "method": "GET", - "header": [], + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/q-1+f-jpg", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/f-aaa", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "q-1+f-jpg" + "f-aaa" ] } }, "response": [] }, { - "name": "PNG", + "name": "Download as PNG: OK", "event": [ { "listen": "test", @@ -903,32 +932,30 @@ "method": "GET", "header": [], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/q-1+f-png", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/f-png", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "q-1+f-png" + "f-png" ] } }, "response": [] }, { - "name": "WEBP", + "name": "Download as PNG, low quality: OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Received WEBP image derivative\", function() {\r", + "pm.test(\"Received PNG image derivative\", function() {\r", " pm.expect(pm.response.code).to.equal(200);\r", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/webp\");\r", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/png\");\r", "});\r", "" ], @@ -944,32 +971,30 @@ "method": "GET", "header": [], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/q-1+f-webp", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/q-1+f-png", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "q-1+f-webp" + "q-1+f-png" ] } }, "response": [] }, { - "name": "Default", + "name": "Download as JPG, low quality: OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Received default image derivative\", function() {\r", + "pm.test(\"Received JPG image derivative\", function() {\r", " pm.expect(pm.response.code).to.equal(200);\r", - " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/jpeg\");\r", "});\r", "" ], @@ -985,104 +1010,74 @@ "method": "GET", "header": [], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/q-1+f-jpg", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", - "{{imageIdentifier}}" + "{{imageIdentifier}}", + "q-1+f-jpg" ] } }, "response": [] }, { - "name": "Derivative Version", + "name": "Download as WEBP, low quality: OK", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " var currentVersion = jsonData.currentVersion;\r", - " pm.collectionVariables.set(\"currentImageVersion\", currentVersion);\r", - " console.log('set currentImageVersion to: ' + pm.collectionVariables.get('currentImageVersion'));\r", - " }\r", - ");" - ], - "type": "text/javascript" - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Received derivative for specific version\", function () {\r", + "pm.test(\"Received WEBP image derivative\", function() {\r", " pm.expect(pm.response.code).to.equal(200);\r", - " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", - "});" + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/webp\");\r", + "});\r", + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - } - ], + "header": [], "url": { - "raw": "{{baseUrl}}/image/{{imageIdentifier}}/version/{{currentImageVersion}}/derivative/q-1", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/q-1+f-webp", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "image", + "images", + "{{user}}", "{{imageIdentifier}}", - "version", - "{{currentImageVersion}}", - "derivative", - "q-1" + "q-1+f-webp" ] } }, "response": [] }, { - "name": "Original Version: No auth", + "name": "Download (default): OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Not allowed to read original Image without auth token\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(401);\r", + "pm.test(\"Received default image derivative\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", "});\r", - "/* {\r", - " \"message\": \"Unauthenticated.\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -1091,77 +1086,49 @@ "type": "noauth" }, "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - } - ], + "header": [], "url": { - "raw": "{{baseUrl}}/image/{{imageIdentifier}}/version/1/original", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "image", - "{{imageIdentifier}}", - "version", - "1", - "original" + "images", + "{{user}}", + "{{imageIdentifier}}" ] } }, "response": [] }, { - "name": "Original Version: OK", + "name": "Download width abc: invalid width", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Received original image\", function() {\r", - " pm.expect(pm.response.code).to.equal(200);\r", - " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", - "});\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " var currentVersion = jsonData.currentVersion;\r", - " pm.collectionVariables.set(\"currentImageVersion\", currentVersion);\r", - " console.log('set currentImageVersion to: ' + pm.collectionVariables.get('currentImageVersion'));\r", - " }\r", - ");\r", + "pm.test(\"Retrieving derivative failed: invalid width parameter\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(400);\r", + "});\r", "/* {\r", - " \"success\": true,\r", - " \"response\": \"Successfully retrieved version numbers.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"currentVersion\": 2,\r", - " \"currentlyProcessedVersion\": null,\r", - " \"versions\": {\r", - " \"2\": 1684330530\r", - " },\r", - " \"client\": \"postman\"\r", - "} */" + " \"message\": \"The provided value abc for the WIDTH parameter is not valid.\"\r", + "} */\r", + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -1174,48 +1141,35 @@ } ], "url": { - "raw": "{{baseUrl}}/image/{{imageIdentifier}}/version/{{currentImageVersion}}/original", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/w-abc", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "image", + "images", + "{{user}}", "{{imageIdentifier}}", - "version", - "{{currentImageVersion}}", - "original" + "w-abc" ] } }, "response": [] }, { - "name": "Version get: No auth", + "name": "Download width 100: OK", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Unable to retreive image versions: no auth\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(401);\r", + "pm.test(\"Received PNG image derivative\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/png\");\r", "});\r", - "/* {\r", - " \"message\": \"Unauthenticated.\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -1224,28 +1178,24 @@ "type": "noauth" }, "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - } - ], + "header": [], "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}/versions", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/w-100", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "media", + "images", + "{{user}}", "{{imageIdentifier}}", - "versions" + "w-100" ] } }, "response": [] }, { - "name": "Version get: OK", + "name": "Download quality 123: invalid quality", "event": [ { "listen": "prerequest", @@ -1253,30 +1203,24 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Image versions retrieved\", function () {\r", + "pm.test(\"Retrieving derivative failed: invalid quality parameter\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.state).to.eql('success');\r", + " pm.expect(pm.response.code).to.equal(400);\r", "});\r", "/* {\r", - " \"state\": 'success',\r", - " \"message\": \"Successfully retrieved version numbers.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"currentVersion\": 3,\r", - " \"currentlyProcessedVersion\": null,\r", - " \"versions\": {\r", - " \"3\": 1684330530\r", - " },\r", - "} */\r", - "" + " \"message\": \"The provided value 123 for the QUALITY parameter is not valid.\"\r", + "} */" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -1289,43 +1233,31 @@ } ], "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}/versions", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/q-123", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "media", + "images", + "{{user}}", "{{imageIdentifier}}", - "versions" + "q-123" ] } }, "response": [] }, { - "name": "Derivative: invalid width parameter", + "name": "Download quality 90: OK", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Retrieving derivative failed: invalid width parameter\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(pm.response.code).to.equal(400);\r", + "pm.test(\"Received PNG image derivative\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/png\");\r", "});\r", - "/* {\r", - " \"message\": \"The provided value abc for the WIDTH parameter is not valid.\"\r", - "} */\r", "" ], "type": "text/javascript", @@ -1334,32 +1266,28 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - } - ], + "header": [], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/w-abc", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/q-90", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "w-abc" + "q-90" ] } }, "response": [] }, { - "name": "Derivative: invalid height parameter", + "name": "Download height xyz: invalid height", "event": [ { "listen": "prerequest", @@ -1380,7 +1308,7 @@ " pm.expect(pm.response.code).to.equal(400);\r", "});\r", "/* {\r", - " \"message\": \"The provided value bba for the HEIGHT parameter is not valid.\"\r", + " \"message\": \"The provided value xyz for the HEIGHT parameter is not valid.\"\r", "} */" ], "type": "text/javascript", @@ -1397,46 +1325,32 @@ } ], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/h-bba", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/h-xyz", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "h-bba" + "h-xyz" ] } }, "response": [] }, { - "name": "Derivative: invalid quality parameter", + "name": "Download height 100: OK", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Retrieving derivative failed: invalid quality parameter\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(pm.response.code).to.equal(400);\r", + "pm.test(\"Received PNG image derivative\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.equal(\"image/png\");\r", "});\r", - "/* {\r", - " \"message\": \"The provided value 123 for the QUALITY parameter is not valid.\"\r", - "} */" + "" ], "type": "text/javascript", "packages": {} @@ -1444,54 +1358,42 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - } - ], + "header": [], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/q-123", - "protocol": "http", + "raw": "{{domain}}/images/{{user}}/{{imageIdentifier}}/h-100", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ "images", "{{user}}", "{{imageIdentifier}}", - "q-123" + "h-100" ] } }, "response": [] }, { - "name": "Derivative: invalid format parameter", + "name": "Download specific Version original: No auth", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Retrieving derivative failed: invalid format parameter\", function () {\r", + "pm.test(\"Not allowed to read original Image without auth token\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(pm.response.code).to.equal(400);\r", + " console.log(jsonData);\r", + " pm.expect(pm.response.code).to.equal(401);\r", "});\r", "/* {\r", - " \"message\": \"The provided value pgn for the FORMAT parameter is not valid.\"\r", - "} */" + " \"message\": \"Unauthenticated.\"\r", + "} */\r", + "" ], "type": "text/javascript", "packages": {} @@ -1499,6 +1401,9 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", "header": [ { @@ -1507,249 +1412,160 @@ } ], "url": { - "raw": "http://transmorpher.test/images/{{user}}/{{imageIdentifier}}/f-pgn", - "protocol": "http", + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/{{currentImageVersion}}/original", "host": [ - "transmorpher", - "test" + "{{domain}}" ], "path": [ - "images", - "{{user}}", + "api", + "v1", + "image", "{{imageIdentifier}}", - "f-pgn" + "version", + "{{currentImageVersion}}", + "original" ] } }, "response": [] }, { - "name": "Version set: No auth", + "name": "Download specific Version original: Invalid version", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Unable to set image version: no auth\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(401);\r", + "pm.test(\"Cannot download original of non-existing version\", function() {\r", + " pm.expect(pm.response.code).to.equal(404);\r", "});\r", "/* {\r", - " \"message\": \"Unauthenticated.\"\r", + " \"message\": \"Requested Version couldn't be found.\"\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { "listen": "prerequest", "script": { "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " var currentVersion = jsonData.currentVersion;\r", - " pm.collectionVariables.set(\"currentImageVersion\", currentVersion);\r", - " console.log('set currentImageVersion to: ' + pm.collectionVariables.get('currentImageVersion'));\r", - " }\r", - ");\r", - "/* {\r", - " \"success\": true,\r", - " \"response\": \"Successfully retrieved version numbers.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"currentVersion\": 2,\r", - " \"currentlyProcessedVersion\": null,\r", - " \"versions\": {\r", - " \"2\": 1684330530\r", - " },\r", - " \"client\": \"postman\"\r", - "} */" + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", + "method": "GET", "header": [ { "key": "Accept", "value": "application/json" } ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "id_token", - "value": "abc123", - "type": "text" - }, - { - "key": "callback_url", - "value": "http://transmorpher.test/api/test", - "type": "text" - }, - { - "key": "_method", - "value": "patch", - "type": "text" - } - ] - }, "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}/version/{{currentImageVersion}}", + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/999999999/original", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "media", + "api", + "v1", + "image", "{{imageIdentifier}}", "version", - "{{currentImageVersion}}" + "999999999", + "original" ] } }, "response": [] }, { - "name": "Version set: OK", + "name": "Download specific Version original: OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Image version set\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.state).to.eql('success');\r", + "pm.test(\"Received original image\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", "});\r", - "/* {\r", - " \"state\": 'success',\r", - " \"message\": \"Successfully set media version.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"version\": 2,\r", - " \"public_path\": \"postman/postmanTestImage\",\r", - " \"upload_token\": \"6464e2634f4aa\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { "listen": "prerequest", "script": { "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " var currentVersion = jsonData.currentVersion;\r", - " pm.collectionVariables.set(\"currentImageVersion\", currentVersion);\r", - " console.log('set currentImageVersion to: ' + pm.collectionVariables.get('currentImageVersion'));\r", - " }\r", - ");\r", - "/* {\r", - " \"success\": true,\r", - " \"response\": \"Successfully retrieved version numbers.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"currentVersion\": 2,\r", - " \"currentlyProcessedVersion\": null,\r", - " \"versions\": {\r", - " \"2\": 1684330530\r", - " },\r", - " \"client\": \"postman\"\r", - "} */" + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "Accept", "value": "application/json" } ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "callback_url", - "value": "http://transmorpher.test/api/test", - "type": "text" - }, - { - "key": "_method", - "value": "patch", - "type": "text" - } - ] - }, "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}/version/{{currentImageVersion}}", + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/{{currentImageVersion}}/original", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "media", + "api", + "v1", + "image", "{{imageIdentifier}}", "version", - "{{currentImageVersion}}" + "{{currentImageVersion}}", + "original" ] } }, "response": [] }, { - "name": "Delete: No auth", + "name": "Download specific Version derivative: No auth", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Unable to delete image: no auth\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(401);\r", - "});\r", - "/* {\r", - " \"message\": \"Unauthenticated.\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ + "pm.test(\"Not allowed to read derivative of an Image Version without auth token\", function () {\r", + " pm.expect(pm.response.code).to.equal(401);\r", + "});\r", + "/* {\r", + " \"message\": \"Unauthenticated.\"\r", + "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -1757,187 +1573,274 @@ "auth": { "type": "noauth" }, - "method": "DELETE", + "method": "GET", "header": [ { "key": "Accept", "value": "application/json" } ], - "body": { - "mode": "formdata", - "formdata": [] - }, "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}", + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/{{currentImageVersion}}/derivative/q-1", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "media", - "{{imageIdentifier}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "api", + "v1", + "image", + "{{imageIdentifier}}", + "version", + "{{currentImageVersion}}", + "derivative", + "q-1" ] } }, "response": [] }, { - "name": "Delete: OK", + "name": "Download specific Version derivative: Invalid version", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Image deleted\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.state).to.eql('deleted');\r", - "});\r", - "/* {\r", - " \"state\": 'deleted',\r", - " \"response\": \"Successfully deleted media.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - "} */\r", - "pm.test(\"Image not found after deletion\", function () {\r", - " pm.sendRequest(\r", - " {\r", - " url: \"http://transmorpher.test/api/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " console.log(jsonData);\r", - " pm.expect(response.code).to.eql(404);\r", - " }\r", - " );\r", + "pm.test(\"Cannot download derivative of non-existing version\", function() {\r", + " pm.expect(pm.response.code).to.equal(404);\r", "});\r", "/* {\r", - " message: \"Requested Media couldn't be found.\"\r", - "} */\r", + " \"message\": \"Requested Version couldn't be found.\"\r", + "} */" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/99999999/derivative/q-1", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "image", + "{{imageIdentifier}}", + "version", + "99999999", + "derivative", + "q-1" + ] + } + }, + "response": [] + }, + { + "name": "Download specific Version derivative: OK", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Received derivative for specific version\", function () {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + " pm.expect(pm.response.contentInfo().mimeType).to.be.equal(\"image\");\r", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{domain}}/api/v1/image/{{imageIdentifier}}/version/{{currentImageVersion}}/derivative/q-1", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "image", + "{{imageIdentifier}}", + "version", + "{{currentImageVersion}}", + "derivative", + "q-1" + ] + } + }, + "response": [] + }, + { + "name": "List Versions: No auth", + "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Unable to retreive image versions: no auth\", function () {\r", + " var jsonData = pm.response.json();\r", + " console.log(jsonData);\r", + " pm.expect(pm.response.code).to.equal(401);\r", + "});\r", + "/* {\r", + " \"message\": \"Unauthenticated.\"\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "DELETE", + "auth": { + "type": "noauth" + }, + "method": "GET", "header": [ { "key": "Accept", "value": "application/json" } ], - "body": { - "mode": "formdata", - "formdata": [] - }, "url": { - "raw": "{{baseUrl}}/media/{{imageIdentifier}}", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}/versions", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "media", - "{{imageIdentifier}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "{{imageIdentifier}}", + "versions" ] } }, "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "pm.sendRequest(", - " {", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/image/reserveUploadSlot\",", - " method: \"POST\",", - " header: {", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),", - " \"Accept\": \"application/json\",", - " \"Content-Type\": \"application/json\"", - " },", - " body: {", - " \"mode\": \"application/json\",", - " \"raw\": JSON.stringify(", - " {", - " 'identifier': pm.collectionVariables.get(\"imageIdentifier\")", - " }", - " )", - " }", - " }, function (err, response) {", - " var jsonData = response.json();", - " console.log(jsonData);", - " pm.collectionVariables.set('imageUploadToken', jsonData.upload_token);", - " console.log('set imageUploadToken to: ' + pm.collectionVariables.get('imageUploadToken'));", - " console.log('-------------------------------------------')", - " }", - ");", - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Video", - "item": [ + "name": "List Versions: OK", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Image versions retrieved\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.state).to.eql('success');\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "/* {\r", + " \"state\": 'success',\r", + " \"message\": \"Successfully retrieved version numbers.\",\r", + " \"identifier\": \"postmanTestImage\",\r", + " \"currentVersion\": 3,\r", + " \"currentlyProcessedVersion\": 3,\r", + " \"versions\": {\r", + " \"1\": 1720201274,\r", + " \"2\": 1720205610,\r", + " \"3\": 1720208565\r", + " },\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}/versions", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "media", + "{{imageIdentifier}}", + "versions" + ] + } + }, + "response": [] + }, { - "name": "Reserve slot: No auth", + "name": "Restore old Version: No auth", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Unable to obtain video upload token: no auth\", function () {\r", + "pm.test(\"Unable to set image version: no auth\", function () {\r", " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", " pm.expect(pm.response.code).to.equal(401);\r", @@ -1947,13 +1850,21 @@ "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} } } ], - "protocolProfileBehavior": { - "disabledSystemHeaders": {} - }, "request": { "auth": { "type": "noauth" @@ -1969,68 +1880,65 @@ "mode": "formdata", "formdata": [ { - "key": "identifier", - "value": "postmanUnusedVideo", + "key": "id_token", + "value": "abc123", "type": "text" }, { - "key": "callback_url", - "value": "{{videoCallbackUrl}}", + "key": "_method", + "value": "patch", "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/video/reserveUploadSlot", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}/version/{{currentImageVersion}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "video", - "reserveUploadSlot" + "api", + "v1", + "media", + "{{imageIdentifier}}", + "version", + "{{currentImageVersion}}" ] } }, "response": [] }, { - "name": "Reserve slot: Invalid identifier", + "name": "Restore old Version: Invalid Version", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ + "pm.test(\"Unable to set non-existing Image version\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(404);\r", + "});\r", + "/* {\r", + " \"message\": \"Requested Version couldn't be found.\"\r", + "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Unable to obtain video upload slot: Invalid identifier\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.json().errors).to.have.property(\"identifier\");\r", - "});\r", - "/* {\r", - " \"message\": \"The identifier format is invalid.\",\r", - " \"errors\": {\r", - " \"identifier\": [\r", - " \"The identifier format is invalid.\"\r", - " ]\r", - " }\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], - "protocolProfileBehavior": { - "disabledSystemHeaders": {} - }, "request": { "method": "POST", "header": [ @@ -2043,66 +1951,67 @@ "mode": "formdata", "formdata": [ { - "key": "identifier", - "value": "--not-allowed", - "type": "text" - }, - { - "key": "callback_url", - "value": "{{videoCallbackUrl}}", + "key": "_method", + "value": "patch", "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/video/reserveUploadSlot", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}/version/99999999", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "video", - "reserveUploadSlot" + "api", + "v1", + "media", + "{{imageIdentifier}}", + "version", + "99999999" ] } }, "response": [] }, { - "name": "Reserve slot: OK", + "name": "Restore old Version: OK", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ + "pm.test(\"Image version set\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.state).to.eql('success');\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "/* {\r", + " \"state\": \"success\",\r", + " \"message\": \"Successfully set image version.\",\r", + " \"identifier\": \"postmanTestImage\",\r", + " \"version\": 2,\r", + " \"public_path\": \"images/postman/postmanTestImage\",\r", + " \"upload_token\": \"66885feb496fe\",\r", + " \"hash\": \"021881ce82531c8a30d6db156e49635a\"\r", + "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Obtained video upload token\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(jsonData.state).to.eql('initializing');\r", - "});\r", - "/* {\r", - " \"state\": 'initializing',\r", - " \"message\": \"Successfully created upload slot.\",\r", - " \"identifier\": \"postmanUnusedVideo\",\r", - " \"upload_token\": \"6464c1a67c372\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], - "protocolProfileBehavior": { - "disabledSystemHeaders": {} - }, "request": { "method": "POST", "header": [ @@ -2115,47 +2024,48 @@ "mode": "formdata", "formdata": [ { - "key": "identifier", - "value": "postmanUnusedVideo", - "type": "text" - }, - { - "key": "callback_url", - "value": "{{videoCallbackUrl}}", + "key": "_method", + "value": "patch", "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/video/reserveUploadSlot", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}/version/{{currentImageVersion}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "video", - "reserveUploadSlot" + "api", + "v1", + "media", + "{{imageIdentifier}}", + "version", + "{{currentImageVersion}}" ] } }, "response": [] }, { - "name": "Upload: No auth", + "name": "Delete: No auth", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Unable to upload video: no auth\", function () {\r", + "pm.test(\"Unable to delete image: no auth\", function () {\r", " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(404);\r", + " pm.expect(pm.response.code).to.equal(401);\r", "});\r", "/* {\r", - " \"message\": \"Requested UploadSlot couldn't be found.\"\r", - "} */" + " \"message\": \"Unauthenticated.\"\r", + "} */\r", + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -2164,7 +2074,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2172,7 +2083,7 @@ "auth": { "type": "noauth" }, - "method": "POST", + "method": "DELETE", "header": [ { "key": "Accept", @@ -2181,65 +2092,79 @@ ], "body": { "mode": "formdata", - "formdata": [ - { - "key": "file", - "type": "file", - "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" - } - ] + "formdata": [] }, "url": { - "raw": "{{baseUrl}}/upload/foo", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "upload", - "foo" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "api", + "v1", + "media", + "{{imageIdentifier}}" ] } }, "response": [] }, { - "name": "Upload: No file", + "name": "Delete: OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Video upload rejected: File field is required\", function () {\r", + "pm.test(\"Image deleted\", function () {\r", " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.json().errors).to.have.property(\"file\");\r", + " pm.expect(jsonData.state).to.eql('deleted');\r", + " pm.expect(pm.response.code).to.equal(200);\r", "});\r", "/* {\r", - " \"message\": \"The file field is required.\",\r", - " \"errors\": {\r", - " \"file\": [\r", - " \"The file field is required.\"\r", - " ]\r", - " }\r", + " \"state\": 'deleted',\r", + " \"response\": \"Successfully deleted media.\",\r", + " \"identifier\": \"postmanTestImage\",\r", + "} */\r", + "pm.test(\"Image not found after deletion\", function () {\r", + " pm.sendRequest(\r", + " {\r", + " url: \"http://transmorpher.test/api/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", + " method: \"GET\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.expect(response.code).to.eql(404);\r", + " }\r", + " );\r", + "});\r", + "/* {\r", + " \"message\": \"Requested Media couldn't be found.\"\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} } } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", + "method": "DELETE", "header": [ { "key": "Accept", @@ -2251,64 +2176,111 @@ "formdata": [] }, "url": { - "raw": "{{baseUrl}}/upload/{{videoUploadToken}}", + "raw": "{{domain}}/api/v1/media/{{imageIdentifier}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "upload", - "{{videoUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "api", + "v1", + "media", + "{{imageIdentifier}}" ] } }, "response": [] + } + ], + "description": "The Transmorpher Media server treats images in realtime. As soon as an image is uploaded, it is available for download. Image transformations are created when they are requested.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "pm.sendRequest(", + " {", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/image/reserveUploadSlot\",", + " method: \"POST\",", + " header: {", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),", + " \"Accept\": \"application/json\",", + " \"Content-Type\": \"application/json\"", + " },", + " body: {", + " \"mode\": \"application/json\",", + " \"raw\": JSON.stringify(", + " {", + " 'identifier': pm.collectionVariables.get(\"imageIdentifier\")", + " }", + " )", + " }", + " }, function (err, response) {", + " var jsonData = response.json();", + " console.log(jsonData);", + " pm.collectionVariables.set('imageUploadToken', jsonData.upload_token);", + " console.log('set imageUploadToken to: ' + pm.collectionVariables.get('imageUploadToken'));", + " console.log('-------------------------------------------')", + " }", + ");", + "" + ] + } }, { - "name": "Upload: Wrong mime type", + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Video", + "item": [ + { + "name": "Reserve upload slot: OK", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Video upload rejected: File has wrong mime type\", function () {\r", - " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.json().errors).to.have.property(\"file\");\r", - "});\r", - "/* {\r", - " \"message\": \"The file must be a file of type: video/x-msvideo, video/mpeg, video/ogg, video/webm, video/mp4.\",\r", - " \"errors\": {\r", - " \"file\": [\r", - " \"The file must be a file of type: video/x-msvideo, video/mpeg, video/ogg, video/webm, video/mp4.\"\r", - " ]\r", - " }\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ + "pm.test(\"Obtained video upload token\", function () {\r", + " var jsonData = pm.response.json();\r", + " console.log(jsonData);\r", + " pm.expect(jsonData.state).to.eql('initializing');\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "/* {\r", + " \"state\": 'initializing',\r", + " \"message\": \"Successfully created upload slot.\",\r", + " \"identifier\": \"postmanTestVideo\",\r", + " \"upload_token\": \"6464c1a67c372\"\r", + "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, "request": { - "auth": { - "type": "noauth" - }, "method": "POST", "header": [ { @@ -2319,11 +2291,6 @@ "body": { "mode": "formdata", "formdata": [ - { - "key": "file", - "type": "file", - "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" - }, { "key": "identifier", "value": "{{videoIdentifier}}", @@ -2332,75 +2299,56 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{videoUploadToken}}", + "raw": "{{domain}}/api/v1/video/reserveUploadSlot", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ - "upload", - "{{videoUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "api", + "v1", + "video", + "reserveUploadSlot" ] - } + }, + "description": "Providing the auth token, the client reserves an upload slot for a video identifier. This action of the client backend secures the transaction, allowing the frontend to upload the video to the Transmorpher media server directly." }, "response": [] }, { - "name": "Upload: Slot expired", + "name": "Upload: Wrong mime type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Video upload rejected: Upload slot expired\", function () {\r", + "pm.test(\"Video upload rejected: File has wrong mime type\", function () {\r", " var jsonData = pm.response.json();\r", " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(404);\r", + " pm.expect(pm.response.json().errors).to.have.property(\"file\");\r", + " pm.expect(pm.response.code).to.equal(422);\r", "});\r", "/* {\r", - " \"message\": \"Requested UploadSlot couldn't be found.\"\r", + " \"message\": \"The file must be a file of type: video/x-msvideo, video/mpeg, video/ogg, video/webm, video/mp4.\",\r", + " \"errors\": {\r", + " \"file\": [\r", + " \"The file must be a file of type: video/x-msvideo, video/mpeg, video/ogg, video/webm, video/mp4.\"\r", + " ]\r", + " }\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { "listen": "prerequest", "script": { "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/video/reserveUploadSlot\",\r", - " method: \"POST\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " },\r", - " body: {\r", - " \"mode\": \"application/json\",\r", - " \"raw\": JSON.stringify(\r", - " {\r", - " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", - " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", - " }\r", - " )\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " console.log(jsonData);\r", - " }\r", - ");\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2421,25 +2369,25 @@ { "key": "file", "type": "file", - "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" + "src": "/C:/Windows/System32/FeatureToastBulldogImg.png" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" } ] }, "url": { - "raw": "{{baseUrl}}/upload/{{videoUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{videoUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, @@ -2455,18 +2403,23 @@ "pm.test(\"Video uploaded\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData.state).to.eql('processing');\r", + " pm.expect(pm.response.code).to.equal(201);\r", + " pm.collectionVariables.set('currentVideoVersion', jsonData.version);\r", + " console.log('set currentVideoVersion to: ' + pm.collectionVariables.get('currentVideoVersion'));\r", "});\r", "/* {\r", - " \"state\": 'processing',\r", + " \"state\": \"processing\",\r", " \"message\": \"Successfully uploaded new video version, transcoding job has been dispatched.\",\r", " \"identifier\": \"postmanTestVideo\",\r", - " \"version\": 2,\r", + " \"version\": 1,\r", " \"public_path\": null,\r", - " \"upload_token\": \"6464c4c93e217\"\r", + " \"upload_token\": \"668866635232e\",\r", + " \"hash\": null\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -2475,7 +2428,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2506,141 +2460,111 @@ ] }, "url": { - "raw": "{{baseUrl}}/upload/{{videoUploadToken}}", + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "upload", "{{videoUploadToken}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] - } + }, + "description": "Providing the correct upload slot token for the video identifier, the client frontend can upload the video to the Transmorpher media server. When the video has been transcoded, the client backend will receive a notification message, which includes the public URL of the video." }, "response": [] }, { - "name": "Version set: OK", + "name": "List Versions: OK", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Video version set\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.state).to.eql('processing');\r", - "});\r", - "/* {\r", - " \"state\": 'processing',\r", - " \"message\": \"Successfully set media version.\",\r", - " \"identifier\": \"postmanTestVideo\",\r", - " \"version\": 3,\r", - " \"public_path\": null,\r", - " \"upload_token\": \"646752a25011c\"\r", - "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ - "pm.sendRequest(\r", - " {\r", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/media/\" + pm.collectionVariables.get(\"videoIdentifier\") + \"/versions\",\r", - " method: \"GET\",\r", - " header: {\r", - " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", - " \"Accept\": \"application/json\",\r", - " \"Content-Type\": \"application/json\"\r", - " }\r", - " }, function (err, response) {\r", - " var jsonData = response.json();\r", - " var currentVersion = jsonData.currentVersion;\r", - " pm.collectionVariables.set(\"currentVideoVersion\", currentVersion);\r", - " console.log('set currentVideoVersion to: ' + pm.collectionVariables.get('currentVideoVersion'));\r", - " }\r", - ");\r", + "pm.test(\"Video versions retrieved\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.state).to.eql('success');\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", "/* {\r", - " \"success\": true,\r", - " \"response\": \"Successfully retrieved version numbers.\",\r", - " \"identifier\": \"postmanTestImage\",\r", - " \"currentVersion\": 2,\r", - " \"currentlyProcessedVersion\": null,\r", + " \"state\": 'success',\r", + " \"message\": \"Successfully retrieved version numbers.\",\r", + " \"identifier\": \"postmanTestVideo\",\r", + " \"currentVersion\": 3,\r", + " \"currentlyProcessedVersion\": 3,\r", " \"versions\": {\r", - " \"2\": 1684330530\r", + " \"1\": 1720201274,\r", + " \"2\": 1720205610,\r", + " \"3\": 1720208565\r", " },\r", - " \"client\": \"postman\"\r", - "} */" + "} */\r", + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "Accept", "value": "application/json" } ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "callback_url", - "value": "http://transmorpher.test/api/test", - "type": "text" - }, - { - "key": "_method", - "value": "patch", - "type": "text" - } - ] - }, "url": { - "raw": "{{baseUrl}}/media/{{videoIdentifier}}/version/{{currentVideoVersion}}", + "raw": "{{domain}}/api/v1/media/{{videoIdentifier}}/versions", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "media", "{{videoIdentifier}}", - "version", - "{{currentVideoVersion}}" + "versions" ] } }, "response": [] }, { - "name": "Delete: No auth", + "name": "Restore old Version: OK", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Unable to delete video: no auth\", function () {\r", + "pm.test(\"Video version set\", function () {\r", " var jsonData = pm.response.json();\r", - " console.log(jsonData);\r", - " pm.expect(pm.response.code).to.equal(401);\r", + " pm.expect(jsonData.state).to.eql('processing');\r", + " pm.expect(pm.response.code).to.equal(200);\r", "});\r", "/* {\r", - " \"message\": \"Unauthenticated.\"\r", + " \"state\": \"processing\",\r", + " \"message\": \"Successfully set video version, transcoding job has been dispatched.\",\r", + " \"identifier\": \"postmanTestVideo\",\r", + " \"version\": 5,\r", + " \"public_path\": null,\r", + " \"upload_token\": \"668876687f4d6\",\r", + " \"hash\": null\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -2649,15 +2573,13 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", + "method": "POST", "header": [ { "key": "Accept", @@ -2666,23 +2588,26 @@ ], "body": { "mode": "formdata", - "formdata": [] + "formdata": [ + { + "key": "_method", + "value": "patch", + "type": "text" + } + ] }, "url": { - "raw": "{{baseUrl}}/media/{{videoIdentifier}}", + "raw": "{{domain}}/api/v1/media/{{videoIdentifier}}/version/{{currentVideoVersion}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "media", - "{{videoIdentifier}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } + "{{videoIdentifier}}", + "version", + "{{currentVideoVersion}}" ] } }, @@ -2698,11 +2623,12 @@ "pm.test(\"Video deleted\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData.state).to.eql('deleted');\r", + " pm.expect(pm.response.code).to.equal(200);\r", "});\r", "/* {\r", " \"state\": 'deleted',\r", " \"response\": \"Successfully deleted media.\",\r", - " \"identifier\": \"postmanTestImage\",\r", + " \"identifier\": \"postmanTestVideo\",\r", "} */\r", "pm.test(\"Video not found after deletion\", function () {\r", " pm.sendRequest(\r", @@ -2722,11 +2648,12 @@ " );\r", "});\r", "/* {\r", - " message: \"Requested Media couldn't be found.\"\r", + " \"message\": \"Requested Media couldn't be found.\"\r", "} */\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -2735,7 +2662,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2752,26 +2680,22 @@ "formdata": [] }, "url": { - "raw": "{{baseUrl}}/media/{{videoIdentifier}}", + "raw": "{{domain}}/api/v1/media/{{videoIdentifier}}", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "media", "{{videoIdentifier}}" - ], - "query": [ - { - "key": null, - "value": "", - "disabled": true - } ] } }, "response": [] } ], + "description": "The Transmorpher Media server processes videos in a queue. When the encoding into regular and stream formats is completed, the client is notified through a signed call. The client has to use the public key URL to verify the server's signature.", "event": [ { "listen": "prerequest", @@ -2780,7 +2704,7 @@ "exec": [ "pm.sendRequest(", " {", - " url: pm.collectionVariables.replaceIn(\"{{baseUrl}}\") + \"/video/reserveUploadSlot\",", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",", " method: \"POST\",", " header: {", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),", @@ -2820,7 +2744,7 @@ ] }, { - "name": "Get public key", + "name": "Get public key: OK", "event": [ { "listen": "test", @@ -2831,7 +2755,8 @@ "});\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2844,14 +2769,57 @@ } ], "url": { - "raw": "{{baseUrl}}/publickey", + "raw": "{{domain}}/api/v1/publickey", "host": [ - "{{baseUrl}}" + "{{domain}}" ], "path": [ + "api", + "v1", "publickey" ] + }, + "description": "Messages from the Transmorpher media server to a client are signed. This public key allows verifying the identity of the notification sender." + }, + "response": [] + }, + { + "name": "Get cache invalidator: OK", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Received the cache invalidation reset counter\", function() {\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "// 0" + ], + "type": "text/javascript", + "packages": {} + } } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{domain}}/api/v1/cacheInvalidator", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "cacheInvalidator" + ] + }, + "description": "When the Transmorpher server needs to invalidate its derivatives, it sends a notification to all clients. The clients can also look up the current invalidation count with this call. The value is to be used as part of the cache buster in the URL." }, "response": [] } @@ -2889,7 +2857,7 @@ "variable": [ { "key": "authToken", - "value": "ONjT9Fnm512HOFoATgsF5hSNkTwcMtmcumxSV340da10aace", + "value": "thisIsAnExamplePleaseEnterTheCorrectTokenForUser", "type": "string" }, { @@ -2897,11 +2865,6 @@ "value": "transmorpher.test", "type": "string" }, - { - "key": "apiVersion", - "value": "1", - "type": "string" - }, { "key": "----------------------------", "value": "", @@ -2912,14 +2875,9 @@ "value": "postman", "type": "string" }, - { - "key": "baseUrl", - "value": "{{domain}}/api/v{{apiVersion}}", - "type": "string" - }, { "key": "imageUploadToken", - "value": "foo", + "value": "exampleUploadToken", "type": "string" }, { @@ -2929,7 +2887,7 @@ }, { "key": "videoUploadToken", - "value": "foo", + "value": "exampleUploadToken", "type": "string" }, { @@ -2937,19 +2895,14 @@ "value": "postmanTestVideo", "type": "string" }, - { - "key": "videoCallbackUrl", - "value": "http://maminator/transmorpher/callback", - "type": "string" - }, { "key": "currentImageVersion", - "value": "0", + "value": "5", "type": "string" }, { "key": "currentVideoVersion", - "value": "0", + "value": "5", "type": "string" } ]