CRUD Bucket is a web application which allows users to easily upload, organize and share files. All users can view and download all other users’ files. Users can rename and delete files their own files, as well. Date uploaded and date modified are automatically generated and shown for each file. Files can be organized into folders, and folders can be created within other folders allowing users to organize their files as they like.
Use this API to communicate with the CRUD-Bucket Back End.
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /sign-up |
users#signup |
POST | /sign-in |
users#signin |
PATCH | /change-password/:id |
users#changepw |
DELETE | /sign-out/:id |
users#signout |
Request:
curl --include --request POST http://localhost:3000/sign-up \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "[email protected]",
"password": "an example password",
"password_confirmation": "an example password"
}
}'
scripts/sign-up.sh
Response:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "[email protected]"
}
}
Request:
curl --include --request POST http://localhost:3000/sign-in \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "[email protected]",
"password": "an example password"
}
}'
scripts/sign-in.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "[email protected]",
"token": "33ad6372f795694b333ec5f329ebeaaa"
}
}
Request:
curl --include --request PATCH http://localhost:3000/change-password/$ID \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"passwords": {
"old": "an example password",
"new": "super sekrit"
}
}'
ID=1 TOKEN=33ad6372f795694b333ec5f329ebeaaa scripts/change-password.sh
Response:
HTTP/1.1 204 No Content
Request:
curl --include --request DELETE http://localhost:3000/sign-out/$ID \
--header "Authorization: Token token=$TOKEN"
ID=1 TOKEN=33ad6372f795694b333ec5f329ebeaaa scripts/sign-out.sh
Response:
HTTP/1.1 204 No Content
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /users |
users#index |
GET | /users/1 |
users#show |
Request:
curl --include --request GET http://localhost:3000/users \
--header "Authorization: Token token=$TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa scripts/users.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"users": [
{
"id": 2,
"email": "[email protected]"
},
{
"id": 1,
"email": "[email protected]"
}
]
}
Request:
curl --include --request GET http://localhost:3000/users/$ID \
--header "Authorization: Token token=$TOKEN"
ID=2 TOKEN=33ad6372f795694b333ec5f329ebeaaa scripts/user.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 2,
"email": "[email protected]"
}
}
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /rootfolders |
folders#createRoot |
GET | /rootfolders/:path |
folders#showRoot |
GET | /folders/:path |
folders#index |
GET | /userfolders |
folders#showByOwner |
GET | /folders |
folders#index |
GET | /folders/:id |
folders#show |
POST | /folders |
folders#create |
PATCH | /folders/:id |
folders#update |
DELETE | /folders/:id |
folders#destroy |
Request:
curl --include --request POST http://localhost:3000/rootfolders \
--header "Content-Type: application/json" \
--data '{
"folder": {
"name": "exampleFolderName",
"path": "examplePath",
"_owner": "exampleUserId"
}
}'
Request:
curl --include --request GET http://localhost:3000/folders/:examplePath \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/rootfolders/:examplePath \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/userfolders \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/folders \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/folders/:id \
--header "Content-Type: application/json"
Request:
curl --include --request POST http://localhost:3000/folders \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"folder": {
"name": "exampleName",
"path": "examplePath"
}
}'
Request:
curl --include --request PATCH http://localhost:3000/folders/:id \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"folder": {
"name": "exampleName",
"path": "examplePath"
}
}'
Request:
curl --include --request DELETE http://localhost:3000/folders/:id \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /rootfiles/:path |
files#showRoot |
GET | /files |
files#index |
GET | /files/:id |
files#show |
POST | /files |
files#create |
PATCH | /files/:id |
files#update |
DELETE | /files/:id |
files#destroy |
Request:
curl --include --request GET http://localhost:3000/files/:examplePath \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/files \
--header "Content-Type: application/json"
Request:
curl --include --request GET http://localhost:3000/files/:id \
--header "Content-Type: application/json"
Request:
curl --include --request POST http://localhost:3000/files \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"file": {
"name": "exampleName",
"path": "examplePath"
}
}'
Request:
curl --include --request PATCH http://localhost:3000/files/:id \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"file": {
"name": "exampleName",
"path": "examplePath"
}
}'
Request:
curl --include --request DELETE http://localhost:3000/files/:id \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].