diff --git a/Upload-a-new-applcation.md b/Upload-a-new-applcation.md index 2fcb974..f933cd6 100644 --- a/Upload-a-new-applcation.md +++ b/Upload-a-new-applcation.md @@ -4,21 +4,19 @@ ## Authorization required: Yes (Header: Bearer auth, key is located in .env file) -## Endpoint: `/apps` +## Endpoint: `/uploadapp` ## Parameters required: ``` Multipart body: -1. metadata (JSON, everything is required except for customPath): +1. metadata (JSON, everything is required): { "name": "App Market Manager", "ver": "1", - "appid": "784875887587", "info": "thisisatestedit", - "pub": "matu6968", - "customPath": "insert/a/custom/path" + "pub": "matu6968" } 2. file (required): @@ -35,44 +33,61 @@ If it is successful: "appid": "784875887587", "info": "thisisatestedit", "pub": "matu6968", - "path": "/uploads/App_Market_Manager/index.js" + "path": "/apps/files/App Market Manager_1.js" } Status code: 200 ``` -If there is no token or a invalid token: +If there is no token specified in header: ``` -Unauthorized +{ + "error": "No authorization header" +} Status code: 401 ``` + +If there is a invalid token: +``` +{ + "error": "Invalid token" +} + +Status code: 401 +``` + +If there is no file provided: +``` +{ + "error": "No file provided" +} + +Status code: 400 +``` + If there is invalid JSON metadata in the multipart body: ``` -Invalid metadata JSON +{ + "error": "Invalid metadata" +} Status code: 400 ``` -If there is a problem during a file upload or no file is specified during uploading: -``` -File upload error -Status code: 400 +If there is a problem while making a directory to the uploaded file: (likely cause is directory where the binary is located is set to read only) ``` -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 +{ + "error": "Failed to make directory" +} Status code: 500 ``` -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) + +If there is a problem while saving apps.json onto the host or while saving the uploaded file: (likely cause is directory where the binary is located is set to read only) ``` -Failed to save app data +{ + "error": "Failed to save file" +} Status code: 500 -``` -If there is invalid multipart body: -``` -Invalid form data - -Status code: 400 ``` \ No newline at end of file