Vridlo/api/vridlo.users: Difference between revisions
m (Majioa moved page Vridlo/api/vridlo.user.id to Vridlo/api/vridlo.users) |
No edit summary |
||
Line 21: | Line 21: | ||
===== Arguments ===== | ===== Arguments ===== | ||
* per_page | NOTE: Arguments can be provided as arguments along with headers fields. | ||
* '''per_page''' is ''natural '''optional''''' | |||
Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50. | Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50. | ||
* page | * '''page''' is ''natural '''optional''''' | ||
The page of results to return. If this argument is omitted, it defaults to 1. | The page of results to return. If this argument is omitted, it defaults to 1. | ||
* '''names''' is ''[[Vridlo/type/Name|Name]] array '''mandatory''''' | |||
Name array for the user. It can include first name, last name, nickname, or title. | |||
* '''permissions''' is ''[[Vridlo/type/Permission|Permission]] array '''mandatory''''' | |||
Defines permissions for the account, permissions include the admin, or any other write permission to a model. | |||
* '''descriptions''' is ''[[Vridlo/type/Lorem|Lorem]] array '''optional''''' | |||
Descriptions array of the user, which defined as array of [[Vridlo/type/Lorem|Lorems]]. | |||
* '''recitals''' is ''array of [[Vridlo/type/Recital|Recital]]'' (Mandatory) | |||
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc. | |||
===== Example Response ===== | ===== Example 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, | |||
"description": "Info user", | |||
"names": [ | |||
{ | |||
"kind": "firstname", | |||
"text": "User", | |||
"icu_locale": "en_US", | |||
}, | |||
{ | |||
"kind": "paternal", | |||
"text": "Batkovicz", | |||
"icu_locale": "en_US", | |||
}, | |||
{ | |||
"kind": "lastname", | |||
"text": "Batkov", | |||
"icu_locale": "en_US", | |||
" | |||
" | |||
" | |||
}, | }, | ||
"foremost": false | { | ||
"kind": "nickname", | |||
"text": "Bublo", | |||
"icu_locale": "en_US", | |||
} | |||
], | |||
"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", | |||
"titles": { | |||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | |||
"foremost": false | |||
} | |||
] | |||
} | |||
] | ] | ||
Line 120: | Line 134: | ||
=== Path === | === Path === | ||
/v1/users/<slug> | /v1/users/<slug>.json | ||
=== Methods === | === Methods === | ||
Line 133: | Line 147: | ||
===== Arguments ===== | ===== Arguments ===== | ||
* '''names''' is '' | |||
Name array for the user. | * '''names''' is ''[[Vridlo/type/Name|Name]] array '''mandatory''''' | ||
* ''' | Name array for the user. It can include first name, last name, nickname, or title. | ||
* '''permissions''' is ''[[Vridlo/type/Permission|Permission]] array '''mandatory''''' | |||
* ''' | Defines permissions for the account, permissions include the admin, or any other write permission to a model. | ||
* '''descriptions''' is ''[[Vridlo/type/Lorem|Lorem]] array '''optional''''' | |||
Descriptions array of the user, which defined as array of [[Vridlo/type/Lorem|Lorems]]. | |||
* '''recitals''' is ''array of [[Vridlo/type/Recital|Recital]]'' (Mandatory) | * '''recitals''' is ''array of [[Vridlo/type/Recital|Recital]]'' (Mandatory) | ||
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc. | |||
====== Sample request ====== | ====== Sample request ====== | ||
{ | { | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
Line 186: | Line 200: | ||
"y": "55.753165", | "y": "55.753165", | ||
"grid": "yandex", | "grid": "yandex", | ||
" | "titles": { | ||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | }, | ||
"foremost": false | "foremost": false | ||
Line 198: | Line 215: | ||
{ | { | ||
"sign_in_count": 2, | "sign_in_count": 2, | ||
"current_sign_in_at": "", | "current_sign_in_at": "", | ||
"last_sign_in_at": "", | "last_sign_in_at": "", | ||
"confirmed": false, | "confirmed": false, | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
{ | { | ||
"kind": "firstname" | "kind": "firstname", | ||
"text": "User" | "text": "User", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "paternal" | "kind": "paternal", | ||
"text": " | "text": "Batkovicz", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "lastname" | "kind": "lastname", | ||
"text": " | "text": "Batkov", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "nickname" | "kind": "nickname", | ||
"text": "Bublo" | "text": "Bublo", | ||
"icu_locale": "en_US", | |||
} | } | ||
], | ], | ||
Line 255: | Line 274: | ||
"y": "55.753165", | "y": "55.753165", | ||
"grid": "yandex", | "grid": "yandex", | ||
" | "titles": { | ||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | }, | ||
"foremost": false | "foremost": false | ||
Line 307: | Line 329: | ||
"last_sign_in_at": "10.10.1970 10:10:10", | "last_sign_in_at": "10.10.1970 10:10:10", | ||
"confirmed": true, | "confirmed": true, | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
{ | { | ||
"kind": "firstname" | "kind": "firstname", | ||
"text": "User" | "text": "User", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "paternal" | "kind": "paternal", | ||
"text": " | "text": "Batkovicz", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "lastname" | "kind": "lastname", | ||
"text": " | "text": "Batkov", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "nickname" | "kind": "nickname", | ||
"text": "Bublo" | "text": "Bublo", | ||
"icu_locale": "en_US", | |||
} | } | ||
], | ], | ||
Line 359: | Line 384: | ||
"y": "55.753165", | "y": "55.753165", | ||
"grid": "yandex", | "grid": "yandex", | ||
" | "titles": { | ||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | }, | ||
"foremost": false | "foremost": false | ||
Line 408: | Line 436: | ||
====== Sample request ====== | ====== Sample request ====== | ||
{ | { | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
Line 414: | Line 441: | ||
"kind": "firstname" | "kind": "firstname" | ||
"text": "User" | "text": "User" | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "paternal" | "kind": "paternal" | ||
"text": " | "text": "Batkovicz" | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "lastname" | "kind": "lastname" | ||
"text": " | "text": "Batkov" | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "nickname" | "kind": "nickname" | ||
"text": "Bublo" | "text": "Bublo" | ||
"icu_locale": "en_US", | |||
} | } | ||
], | ], | ||
Line 446: | Line 477: | ||
{ | { | ||
"kind": "location", | "kind": "location", | ||
"address": { | |||
"x": "37.618448", | |||
"y": "55.753165", | |||
"grid": "yandex", | |||
"titles": { | |||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | |||
"foremost": false | "foremost": false | ||
} | } | ||
Line 471: | Line 505: | ||
"last_sign_in_at": "10.10.1970 10:10:10", | "last_sign_in_at": "10.10.1970 10:10:10", | ||
"confirmed": true, | "confirmed": true, | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
{ | { | ||
"kind": "firstname" | "kind": "firstname", | ||
"text": "User" | "text": "User", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "paternal" | "kind": "paternal", | ||
"text": " | "text": "Batkovicz", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "lastname" | "kind": "lastname", | ||
"text": " | "text": "Batkov", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "nickname" | "kind": "nickname", | ||
"text": "Bublo" | "text": "Bublo", | ||
"icu_locale": "en_US", | |||
} | } | ||
], | ], | ||
Line 523: | Line 560: | ||
"y": "55.753165", | "y": "55.753165", | ||
"grid": "yandex", | "grid": "yandex", | ||
" | "titles": { | ||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | }, | ||
"foremost": false | "foremost": false | ||
Line 578: | Line 618: | ||
"last_sign_in_at": "10.10.1970 10:10:10", | "last_sign_in_at": "10.10.1970 10:10:10", | ||
"confirmed": true, | "confirmed": true, | ||
"description": "Info user", | "description": "Info user", | ||
"names": [ | "names": [ | ||
{ | { | ||
"kind": "firstname" | "kind": "firstname", | ||
"text": "User" | "text": "User", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "paternal" | "kind": "paternal", | ||
"text": " | "text": "Batkovicz", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "lastname" | "kind": "lastname", | ||
"text": " | "text": "Batkov", | ||
"icu_locale": "en_US", | |||
}, | }, | ||
{ | { | ||
"kind": "nickname" | "kind": "nickname", | ||
"text": "Bublo" | "text": "Bublo", | ||
"icu_locale": "en_US", | |||
} | } | ||
], | ], | ||
Line 630: | Line 673: | ||
"y": "55.753165", | "y": "55.753165", | ||
"grid": "yandex", | "grid": "yandex", | ||
" | "titles": { | ||
text: "Moskva. Kremlin. Senatskij palace", | |||
icu_locale: "en_US", | |||
}, | |||
}, | }, | ||
"foremost": false | "foremost": false |
Revision as of 17:32, 5 December 2019
vridlo.user.index
It allows accessing to a list of users, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.
Path
/v1/users
Methods
GET
Returns a list of users, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.
Authentication
This method requires NO authentication.
Arguments
NOTE: Arguments can be provided as arguments along with headers fields.
- per_page is natural optional
Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
- page is natural optional
The page of results to return. If this argument is omitted, it defaults to 1.
- names is Name array mandatory
Name array for the user. It can include first name, last name, nickname, or title.
- permissions is Permission array mandatory
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
- descriptions is Lorem array optional
Descriptions array of the user, which defined as array of Lorems.
- recitals is array of Recital (Mandatory)
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.
Example 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, "description": "Info user", "names": [ { "kind": "firstname", "text": "User", "icu_locale": "en_US", }, { "kind": "paternal", "text": "Batkovicz", "icu_locale": "en_US", }, { "kind": "lastname", "text": "Batkov", "icu_locale": "en_US", }, { "kind": "nickname", "text": "Bublo", "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "foremost": false } ] } ]
Return Codes
- 200 (OK)
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is finished.
- 206 (Partial Content)
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is NOT finished yet.
- 416 (Range Not Satisfiable)
The resource list is accessible. But data can't be returned since range provided don't match the list boundaries.
- 422.3 (SSL is required)
SSL is required to access the Vridlo API.
- 500 (Service currently unavailable)
The requested service is temporarily unavailable.
vridlo.user.slug
This allows accessing to the specified user record by <slug> URI-parameter. Added into API v1.0.
Path
/v1/users/<slug>.json
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 Name array mandatory
Name array for the user. It can include first name, last name, nickname, or title.
- permissions is Permission array mandatory
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
- descriptions is Lorem array optional
Descriptions array of the user, which defined as array of Lorems.
- recitals is array of Recital (Mandatory)
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.
Sample request
{ "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "foremost": false } ] }
Example Response
Good response with created record:
{ "sign_in_count": 2, "current_sign_in_at": "", "last_sign_in_at": "", "confirmed": false, "description": "Info user", "names": [ { "kind": "firstname", "text": "User", "icu_locale": "en_US", }, { "kind": "paternal", "text": "Batkovicz", "icu_locale": "en_US", }, { "kind": "lastname", "text": "Batkov", "icu_locale": "en_US", }, { "kind": "nickname", "text": "Bublo", "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "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, "description": "Info user", "names": [ { "kind": "firstname", "text": "User", "icu_locale": "en_US", }, { "kind": "paternal", "text": "Batkovicz", "icu_locale": "en_US", }, { "kind": "lastname", "text": "Batkov", "icu_locale": "en_US", }, { "kind": "nickname", "text": "Bublo", "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "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 token 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
{ "description": "Info user", "names": [ { "kind": "firstname" "text": "User" "icu_locale": "en_US", }, { "kind": "paternal" "text": "Batkovicz" "icu_locale": "en_US", }, { "kind": "lastname" "text": "Batkov" "icu_locale": "en_US", }, { "kind": "nickname" "text": "Bublo" "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "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, "description": "Info user", "names": [ { "kind": "firstname", "text": "User", "icu_locale": "en_US", }, { "kind": "paternal", "text": "Batkovicz", "icu_locale": "en_US", }, { "kind": "lastname", "text": "Batkov", "icu_locale": "en_US", }, { "kind": "nickname", "text": "Bublo", "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "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 token 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, "description": "Info user", "names": [ { "kind": "firstname", "text": "User", "icu_locale": "en_US", }, { "kind": "paternal", "text": "Batkovicz", "icu_locale": "en_US", }, { "kind": "lastname", "text": "Batkov", "icu_locale": "en_US", }, { "kind": "nickname", "text": "Bublo", "icu_locale": "en_US", } ], "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", "titles": { text: "Moskva. Kremlin. Senatskij palace", icu_locale: "en_US", }, }, "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.