Skip to content
Maksym Pugach edited this page Oct 18, 2015 · 16 revisions

Table of content

  1. Base url
  2. POST /api/v1/auth/sign_in
  3. GET /api/v1/auth/validate_token
  4. GET /api/v1/people

Base url

http://students.veda-kiev.org.ua


POST /api/v1/auth/sign_in

Details:

Returns token and client in responce header.
https://github.com/lynndylanhurley/devise_token_auth#usage-tldr

Request:

Params:
  • email (required)
  • password (required)

Responce:

Success
JSON:
view
{
    "data": {
        "complex_name": String
    }
}
  
###### Headers: * **access-token** String * **client** String * **uid** String * **expiry** Number
Status:

200

Failure
JSON:
view
{
    "errors": [
        "Invalid login credentials. Please try again."
    ]
}
  
###### Status: 401

GET /api/v1/auth/validate_token

Details:

Validates if token is still valid.
https://github.com/lynndylanhurley/devise_token_auth#usage-tldr

Request:

Params:
  • access-token (required)
  • client (required)
  • uid (required)

Responce:

Success
JSON:
view
{
    "success": true,
    "data": {
        "complex_name": String
    }
}
  
###### Headers: * **access-token** String * **client** String * **uid** String * **expiry** Number
Status:

200

Failure
JSON:
view
{
    "success": false,
    "errors": [
        "Invalid login credentials"
    ]
}
  
###### Status: 401

GET /api/v1/people

Details:

Returns an array of people.
If people_ids provided, returns only people with those ids.
If particular person is not accessible any more or was not found, the id will be present in deleted array.

Request:

Params:
  • access-token (required)
  • client (required)
  • uid (required)
  • people_ids (optional) Array

Responce:

Success
JSON:
view
{
    "deleted": [4, 5],
    "people": [
        {
            "id": 1,
            "spiritual_name": "Adidas das",
            "name": "Андрій",
            "middle_name": null,
            "surname": "Пума",
            "email": null,
            "birthday": "1975-10-11",
            "photo": "https://pp.vk.me/c10513/u136975712/-14/x_5142fe55.jpg",
            "groups": [
                "Викладачі",
                "Адміністратори"
            ],
            "telephones": [
                "+380 50 111 22 33"
            ],
            "version": "575e112ec8b9be422abc07b4b23dadd4711c1e6b"
        },
        {
            "id": 2,
            "spiritual_name": null,
            "name": "Василий",
            "middle_name": "Васильевич",
            "surname": "Васин",
            "email": "[email protected]",
            "birthday": "1985-10-11",
            "photo": "https://pp.vk.me/c10513/u136975712/-14/x_5142fe55.jpg",
            "groups": [
                "Студенти",
                "ШБ15-1",
                "УЧ15-2"
            ],
            "telephones": [
                "+380 50 111 22 34",
                "+380501112235"
            ],
            "version": "b5d8541a2779d5d746bc273eaee75c64d5606951"
        },
        {
            "id": 3,
            "spiritual_name": "Mahasarvajagadguru das",
            "name": "Михайло",
            "middle_name": "Михайлович",
            "surname": "Михайлов",
            "email": "[email protected]",
            "birthday": "1965-10-11",
            "photo": "https://pp.vk.me/c10513/u136975712/-14/x_5142fe55.jpg",
            "groups": [
                "Студенти",
                "ШБ15-1",
                "Старости"
            ],
            "telephones": [
                "+380 50 111 22 36"
            ],
            "version": "1b5e7226992dda21e4dd48356780154e6cbc7a1c"
        }
    ]
}
  
###### Headers: * **access-token** String * **client** String * **uid** String * **expiry** Number
Status:

200