Vridlo/api/vridlo.users
vridlo.user.slug
This allows accessing to the specified user record by <slug> URI-parameter. Added into API v1.0.
Path
/v1/users/<slug>
Methods
POST
Creates the user specified by <slug> URI-parameter using the set of properties passed as form data or get parameter array, and returns state of the created record as JSON.
Authentication
This method requires write authentication with write permission token to user model.
Arguments
- names is array of Name (Mandatory)
Name array for the user.
- admin is boolean (Optional)
Is the user admin, the field requires superuser permission token to user model.
- description is string (Optional)
Description of the user.
- recitals is array of Recital (Mandatory)
Recital record array for the user.
Sample request
{ "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Example Response
Good response with created record:
{ "id": 1, "sign_in_count": 2, "current_sign_in_at": "", "last_sign_in_at": "", "confirmed": false, "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "jabber", "address": "user@jabber.ru", "foremost": false }, { "kind": "website", "address": "http://user.me", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Error response 423:
{ "error_code": 3 }
Return Codes
- 200 (OK)
The resource wasn't found, and was created. Returned data responds to the current state of the resource.
- 422.3 (SSL is required)
SSL is required to access the Vridlo API.
- 422.5 (Invalid incoming data)
The incoming data is invalid. See details for help.
- 404 (Not Found)
The record with provided slug is not found.
- 500 (Internal Server Error)
The Internal Server Error has occurred.
GET
Gets properties of the user specified by <slug> URI-parameter, and returns then as JSON. Do not poll this method more than once an hour.
Authentication
This method requires NO authentication.
Arguments
This method requires NO arguments.
Example Response
Good response:
{ "id": "1", "sign_in_count": "2", "current_sign_in_at": "10.11.1970 10:10:10", "last_sign_in_at": "10.10.1970 10:10:10", "confirmed": true, "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "jabber", "address": "user@jabber.ru", "foremost": false }, { "kind": "website", "address": "http://user.me", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Error response 423:
{ "error_code": 3 }
Return Codes
- 200 (OK)
The resource was found and is accessible. Returned data responds to the current state of the resource.
- 422.3 (SSL is required)
SSL is required to access the Vridlo API.
- 404 (Not Found)
The record with provided slug is not found.
- 500 (Internal Server Error)
The Internal Server Error has occurred.
PUT/PATCH
Sets one or many properties of the user specified by <slug> URI-parameter, and returns updated state as JSON.
Authentication
This method requires write authentication with write permission to user model.
Arguments
NOTE: Blank fields will be skipped, new array fields will be appended
- names is array of Name (Optional)
Name array for the user.
- admin is boolean (Optional)
Is the user admin, the field requires superuser permission token to user model.
- description is string (Optional)
Description of the user.
- recitals is array of Recital (Optional)
Recital record array for the user.
Sample request
{ "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Example Request
PUT:/v1/users/ca?name=Core_Assembler
Example Response
Good response:
{ "id": "1", "sign_in_count": "2", "current_sign_in_at": "10.11.1970 10:10:10", "last_sign_in_at": "10.10.1970 10:10:10", "confirmed": true, "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "jabber", "address": "user@jabber.ru", "foremost": false }, { "kind": "website", "address": "http://user.me", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Error response 423:
{ "error_code": 3 }
Return Codes
- 200 (OK)
The resource was found and is accessible. Changes were made on the resource successfully. Returned data responds to the current state of the resource.
- 204 (No Content)
The resource was found and is accessible. But no changes were made on the resource.
- 422.3 (SSL is required)
SSL is required to access the Vridlo API.
- 422.5 (Invalid incoming data)
The incoming data is invalid. See details for help.
- 404 (Not Found)
The record with provided id/slug is not found.
- 500 (Internal Server Error)
The Internal Server Error has occurred.
DELETE
Destroys the user specified by <slug> URI-parameter, and returns state of the destroyed record as JSON.
Authentication
This method requires write authentication with write permission to user model.
Arguments
This method requires NO arguments.
Example Response
Good response returning deleted record:
{ "id": "1", "sign_in_count": "2", "current_sign_in_at": "10.11.1970 10:10:10", "last_sign_in_at": "10.10.1970 10:10:10", "confirmed": true, "admin": false, "description": "Info user", "names": [ { "kind": "firstname" "text": "User" }, { "kind": "paternal" "text": "Batkovič" }, { "kind": "lastname" "text": "Batkovič" }, { "kind": "nickname" "text": "Bublo" } ], "recitals": [ { "kind": "email", "address": "user@gmail.com", "foremost": false }, { "kind": "email", "address": "user@altlinux.org", "foremost": true }, { "kind": "login", "address": "user", "foremost": false }, { "kind": "jabber", "address": "user@jabber.ru", "foremost": false }, { "kind": "website", "address": "http://user.me", "foremost": false }, { "kind": "location", "address": { "x": "37.618448", "y": "55.753165", "grid": "yandex", "name": "Moskva. Kremlin. Senatskij palace" }, "foremost": false } ] }
Error response 423:
{ "error_code": 3 }
Return Codes
- 200 (OK)
The resource was found and is accessible, and successfully destroyed. Returned data responds to the state of the destroyed resource.
- 422.3 (SSL is required)
SSL is required to access the Vridlo API.
- 404 (Not Found)
The record with provided slug is not found.
- 500 (Internal Server Error)
The Internal Server Error has occurred.