sio-2425/delivery2/server/tests/file_management.http

107 lines
2.2 KiB
HTTP

### Reset database
POST http://localhost:5000/reset
Content-Type: application/json
{
"password": "123"
}
### Create a new organization
POST http://localhost:5000/org/create
Content-Type: application/json
{
"name": "org",
"username": "username",
"full_name": "Full Name",
"email": "user@mail.com",
"public_key": "null"
}
### Login
POST http://localhost:5000/user/login
Content-Type: application/json
{
"username": "username",
"org": "org"
}
> {% client.global.set("token", response.body["token"]) %}
### Upload dummy file metadata
POST http://localhost:5000/file/upload/metadata
Content-Type: application/json
Authorization: {{token}}
{
"document_name": "dummy_file.txt",
"key": "arfarf",
"alg": "ftgtrg"
}
> {% client.global.set("document_handle", response.body["document_handle"]) %}
#### Upload dummy file content, through send file
#POST http://localhost:5000/file/upload/content
#Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
#Authorization: {{token}}
#
#----WebKitFormBoundary7MA4YWxkTrZu0gW
#Content-Disposition: form-data; name="file"; filename="dummy_file.txt"
#Content-Type: text/plain
#
#This is a dummy file
#----WebKitFormBoundary7MA4YWxkTrZu0gW
### List files (with no data)
GET http://localhost:5000/file/list
Content-Type: application/json
Authorization: {{token}}
{}
### List files by user
GET http://localhost:5000/file/list
Content-Type: application/json
Authorization: {{token}}
{
"username": "username"
}
### List files by datetime
GET http://localhost:5000/file/list
Content-Type: application/json
Authorization: {{token}}
{
"datetime": {
"relation": "ot",
"value": "1731863876"
}
}
### Get file metadata
GET http://localhost:5000/file/get/{{document_handle}}/metadata
Content-Type: application/json
Authorization: {{token}}
> {% client.global.set("file_handle", response.body["file_handle"]) %}
### Get file content
GET http://localhost:5000/file/get/{{file_handle}}/content
Content-Type: application/json
Authorization: {{token}}
### Delete dummy file
POST http://localhost:5000/file/delete/{{document_handle}}
Content-Type: application/json
Authorization: {{token}}
### Logout
POST http://localhost:5000/user/logout
Content-Type: application/json
Authorization: {{token}}