-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Lazhari edited this page Feb 13, 2017
·
1 revision
file
required field
name
optional field (used to set a name for the file, or it will named with it's original name)
curl -X POST -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -H "Cache-Control: no-cache" -H "Postman-Token: 2ab0ad5d-ecdf-046c-3d48-54e03bee7619" -F "file=@/Users/macbookproretina13/Downloads/CV Karim Salih.pdf" -F "name=Resume" "http://localhost:3500/api/v1/files"
- Success-Response
HTTP/1.1 201 CREATED
{
"ok": true,
"publicName": "376de710-4c68-406b-8e92-8747e8460412.pdf",
"name": "Resume",
"url": "http://localhost:3500/api/v1/files/376de710-4c68-406b-8e92-8747e8460412.pdf",
"message": "File has been successfully created"
}
- Error-Response
HTTP/1.1 500 INTERNAL SERVER ERROR
{
"ok": false,
"error": ${err.message},
"message": "Error uploading file"
}
url
file url
name
optional field (used to set a name for the file, or it will named with it's original name)
- Success-Response
HTTP/1.1 201 CREATED
{
"ok": true,
"publicName": "376de710-4c68-406b-8e92-8747e8460412.pdf",
"name": "Resume",
"url": "http://localhost:3500/api/v1/files/376de710-4c68-406b-8e92-8747e8460412.pdf",
"message": "File has been successfully created"
}
- Error-Response
HTTP/1.1 500 INTERNAL SERVER ERROR
{
"ok": false,
"error": ${err.message},
"message": "Error uploading file"
}
curl -X GET -H "Cache-Control: no-cache" -H "Postman-Token: 1d2bec92-b917-a8cb-dd64-04bf01f28ce6" "http://localhost:3500/api/v1/files/48ae95ab-927f-45fb-8c9c-c08cb170d7ba.mp4"
- File not found Response
HTTP/1.1 404 NOT FOUND
{
"ok": false,
"message": "File not found!"
}
- Success-Response
HTTP/1.1 200 OK
{
"_id": "589465588a2b3b12d5e04299",
"filename": "1ca00d8e-8b87-4205-b090-b7c8e78ac486.html",
"contentType": "text/html",
"length": 49319,
"uploadDate": "2017-02-03T11:11:21.027Z",
"metadata": {
"mime": "text/html",
"name": "url"
}
}
- File not found Response
HTTP/1.1 404 NOT FOUND
{
"ok": false,
"message": "File not found!"
}
curl -X DELETE -H "Cache-Control: no-cache" -H "Postman-Token: 9509f82f-5816-5339-3de0-772bef44cfe2" "http://localhost:3500/api/v1/files/58e9685c-edee-45ba-af62-8ef3e721509a.mp4"
- Success-Response
HTTP/1.1 200 OK
{
"ok": true,
"message": "58e9685c-edee-45ba-af62-8ef3e721509a.mp4 has been successfully deleted!"
}
- File not found Response
HTTP/1.1 404 NOT FOUND
{
"ok": false,
"message": "File not found!"
}