Vridlo/api/vridlo.permissions: Difference between revisions
(Created page with "== vridlo.permissions == It allows accessing to a list of permissions, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0....") |
No edit summary |
||
Line 196: | Line 196: | ||
==== Authentication ==== | ==== Authentication ==== | ||
This method requires write authentication with '''write''' permission token to ''permission'' model | This method requires write authentication with '''write''' permission token to ''permission'' model. | ||
==== Arguments ==== | ==== Arguments ==== | ||
Line 267: | Line 267: | ||
==== Authentication ==== | ==== Authentication ==== | ||
This method requires write authentication with '''write''' permission token to ''permission'' model | This method requires write authentication with '''write''' permission token to ''permission'' model. | ||
==== Arguments ==== | ==== Arguments ==== |
Latest revision as of 18:14, 27 November 2019
vridlo.permissions
It allows accessing to a list of permissions, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.
GET:/v1/permissions.json
Returns a list of permissions, 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 (Optional)
Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
- page (Optional)
The page of results to return. If this argument is omitted, it defaults to 1.
Examples
Example Request Url
GET:/v1/permissions.json
Example Good Response
[ { "id": 1, "name": "super", "description": "Superuser permission", "model": "", "used_for_users_count": 3, "used_for_groups_count": 2, } ]
Example Bad Response
Error response 416:
{ "message": "Error text according the active language", }
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.
POST:/v1/permissions.json
Creates the permission using the set of properties passed as form data or get parameter array, and returns state of the created record as JSON. Added into API v1.0.
Authentication
This method requires write authentication with write permission token to permission model.
Arguments
- name is string (Mandatory)
Name for the permission. Must be unique among the permission names, and contains only letters and underscores.
- description is string (Optional)
Description of the permission.
- model is string (Optional)
Model affecting the permission, if blank will affects all the models.
Examples
Example Request Url
POST:/v1/permissions.json?name=super&description=Info_permission
Example Request Form
POST:/v1/permissions.json DATA: { "name": "super", "description": "Info_permission", }
Example Good Response
Good response with created record:
{ "id": 1, "name": "super", "description": "Info_permission", "model": "", "used_for_users_count": 0, "used_for_groups_count": 0, }
Example Bad Response
Error response 423:
{ "error_code": 3, "message": "Error text according the active language", }
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:/v1/permissions/<name>.json
Gets properties of the permission specified by <name> URI-parameter, and returns then as JSON. Do not poll this method more than once an hour. Added into API v1.0.
Authentication
This method requires NO authentication.
Arguments
This method requires NO arguments.
Examples
Example Request Url
GET:/v1/permissions/super
Example Good Response
Good response with returned record:
{ "id": 1, "name": "super", "description": "Info_permission", "model": "", "used_for_users_count": 3, "used_for_groups_count": 2, }
Example Bad Response
Error response 423:
{ "error_code": 3, "message": "Error text according the active language", }
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.
PATCH:/v1/permissions/<name>.json
Overwrites one or many specified only properties of the permission specified by <name> URI-parameter, and returns updated state as JSON. Added into API v1.0.
Authentication
This method requires write authentication with write permission token to permission model.
Arguments
NOTE: Blank fields will be skipped, new array fields will be appended
- description is string (Optional)
Description of the permission.
Examples
Example Request Url
PATCH:/v1/permissions/super?description=Info_permission
Example Request Form
PATCH:/v1/permissions/super DATA: { "description": "Info permission", }
Example Good Response
Good response with updated record:
{ "id": 1, "name": "super", "description": "Info_permission", "model": "", "used_for_users_count": 3, "used_for_groups_count": 2, }
Example Bad Response
Error response 423:
{ "error_code": 3, "message": "Error text according the active language", }
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:/v1/permissions/<name>.json
Destroys the permission specified by <name> URI-parameter, and returns state of the destroyed record as JSON. Added into API v1.0.
Authentication
This method requires write authentication with write permission token to permission model.
Arguments
This method requires NO arguments.
Examples
Example Request Url
DELETE:/v1/permissions/super
Example Good Response
Good response returning deleted record:
{ "id": 1, "name": "super", "description": "Info_permission", "model": "", "used_for_users_count": 3, "used_for_groups_count": 2, }
Example Bad Response
Error response 423:
{ "error_code": 3, "message": "Error text according the active language", }
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.