From 0e656f69fb78ba5dbcb6211075b14502fa7900ab Mon Sep 17 00:00:00 2001 From: matu6968 Date: Sun, 10 Nov 2024 23:16:04 +0100 Subject: [PATCH] Add Upload a new applcation --- Upload-a-new-applcation.md | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Upload-a-new-applcation.md diff --git a/Upload-a-new-applcation.md b/Upload-a-new-applcation.md new file mode 100644 index 0000000..c279ed6 --- /dev/null +++ b/Upload-a-new-applcation.md @@ -0,0 +1,63 @@ +# To upload a new app: + +## HTTP request type: `POST` + +## Authorization required: Yes (Bearer auth, key is located in .env file) + +## Endpoint: `/apps` + +## Parameters required: +``` +Multipart body: + +1. metadata (JSON): + + { + "name": "App Market Manager", + "ver": "1", + "appid": "784875887587", + "info": "thisisatestedit", + "pub": "matu6968" + } + +2. file: +Specify to use a file. +``` + +### Output: + +If it is successful: +``` +{ + "name": "App Market Manager", + "ver": "1", + "appid": "784875887587", + "info": "thisisatestedit", + "pub": "matu6968", + "path": "/uploads/App_Market_Manager/index.js" +} +``` +If there is no token or a invalid token: +``` +Unauthorized +``` +If there is invalid JSON metadata in the multipart body: +``` +Invalid metadata JSON +``` +If there is a problem during a file upload or no file is specified during uploading: +``` +File upload error +``` +If there is a problem while saving the uploaded file: (likely cause is directory where the binary is located is set to read only) +``` +Failed to save file +``` +If there is a problem while saving apps.json onto the host: (likely cause is directory where the binary is located is set to read only) +``` +Failed to save app data +``` +If there is invalid multipart body: +``` +Invalid form data +``` \ No newline at end of file