Add Upload a new applcation

matu6968 2024-11-10 23:16:04 +01:00
parent faef02c40d
commit 0e656f69fb

@ -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
```