Update Upload a new applcation

matu6968 2024-11-21 02:11:42 +01:00
parent fa39034bd0
commit b393888363

@ -4,21 +4,19 @@
## Authorization required: Yes (Header: Bearer auth, key is located in .env file) ## Authorization required: Yes (Header: Bearer auth, key is located in .env file)
## Endpoint: `/apps` ## Endpoint: `/uploadapp`
## Parameters required: ## Parameters required:
``` ```
Multipart body: Multipart body:
1. metadata (JSON, everything is required except for customPath): 1. metadata (JSON, everything is required):
{ {
"name": "App Market Manager", "name": "App Market Manager",
"ver": "1", "ver": "1",
"appid": "784875887587",
"info": "thisisatestedit", "info": "thisisatestedit",
"pub": "matu6968", "pub": "matu6968"
"customPath": "insert/a/custom/path"
} }
2. file (required): 2. file (required):
@ -35,44 +33,61 @@ If it is successful:
"appid": "784875887587", "appid": "784875887587",
"info": "thisisatestedit", "info": "thisisatestedit",
"pub": "matu6968", "pub": "matu6968",
"path": "/uploads/App_Market_Manager/index.js" "path": "/apps/files/App Market Manager_1.js"
} }
Status code: 200 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 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: If there is invalid JSON metadata in the multipart body:
``` ```
Invalid metadata JSON {
"error": "Invalid metadata"
}
Status code: 400 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) {
``` "error": "Failed to make directory"
Failed to save file }
Status code: 500 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 Status code: 500
``` ```
If there is invalid multipart body:
```
Invalid form data
Status code: 400
```