# Usage RAILS::API ### USER: #### Create:
-
route create: POST www.domain.com/api/users/create
-
format request: api/users/create?param¶m…
“‘ user = [email protected] user = 1q2w3e4r5t6y7u user = 1q2w3e4r5t6y7u “` #### Update
-
route update: PATCH www.domain.com/api/users/update
-
format request: api/users/update?param¶m…
“‘ user = [email protected] user = 123qwe123qwe
- HTTP_API_TOKEN
“‘ #### Delete
-
route delete: DELETE www.domain.com/api/users/create
-
format request: api/users/delete
“‘
- HTTP_API_TOKEN
“‘ #### Autorization
-
login route: POST www.domain.com/api/sessions
-
format request: api/sessions/param¶m…
“‘ session = [email protected] session = 123qwe123qwe “` After Autorization you get unique api_token: “` {
"_id": { "$oid": "5713b48c8f1ddad88a53c4d7" }, "auth_token": "MtH_mwVKTyvoxJLFWaEW", "email": "[email protected]"
} “‘ You will need auth_token for upload and resize images
#### Unauthorization
-
login route: POST www.domain.com/api/sessions
-
format request: api/sessions/param¶m…
“‘ session = [email protected] session = 123qwe123qwe “` #### List of all images belongs to current user:
-
route index GET www.domain.com/api/show_all_images
-
format request: /api/show_all_images
-
with HEADERS:
“‘
- API_TOKEN
“‘
-
Response example:
“‘ {
"galleries": [ { "_id": { "$oid": "5713d1018f1ddae10d3bc076" }, "file": { "url": "/uploads/123123.png" }, "format": null, "gallery_id": { "$oid": "5713d0e08f1ddae10d3bc075" }, "heigth": null, "width": null } ]
} “‘ #### Resize new image
-
route index GET www.domain.com/api/resize
-
format request: api/resize
-
with HEADERS:
“‘
- API_TOKEN
“‘
-
params:
“‘ gallery = ’123x234’ gallery = file.png/jpeg/jpg
“‘
-
response example:
“‘ {
"status": "Success", "message": "Your new Image was successfully uploaded with 123x235", "url": "/uploads/mini_magick20160418-57613-17uuygi.png", "width": 123, "height": 58
} “‘ #### Resize old image For this operation you need to have at list one image you want to resize
-
route index GET www.domain.com/api/resize_old
-
format request: api/resize_old
-
with HEADERS:
“‘
- API_TOKEN
“‘
-
params:
“‘ gallery = ’123x234’ gallery = file.png “‘ If image exists, it should be resized: “` {
"status": "Success", "message": "Your old Image was successfully uploaded with 123x345"
} “‘ If no image: “` {
"status": "errors", "message": "No file"
} “‘