Vridlo/api/vridlo.assemblers.tasks.exercises: Difference between revisions
Line 297: | Line 297: | ||
"assembler_slug": "core", | "assembler_slug": "core", | ||
"source_path_slug": "sisyphus_core", | "source_path_slug": "sisyphus_core", | ||
"approver_slugs": [], | "approver_slugs": [ "user2" ], | ||
} | } | ||
Revision as of 15:14, 28 November 2019
vridlo.assemblers.tasks.exercises
It allows accessing to a list of exercises, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.
GET:/v1/assembler/<slug>/tasks/<task_no>/exercises.json
Returns a list of exercises, which are presented in the systemfor the specific assembler and task. Do not poll this method more than once an hour. Added into API v1.0.
Authentication
This method requires NO authentication.
Inline Arguments
- slug is string
The assembler slug
- task_no is integer
Integer number of the task for the specified assembler.
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/assembler/core/tasks/100000/exercises.json
Example Good Response
[ { "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "task_no": 100000, "assembler_slug": "core", "source_path_slug": "sisyphus_core", "approver_slugs": [ "user", "user1" ], } ]
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/assembler/<slug>/tasks/<task_no>/exercises.json
Creates the exercise 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 authenticated user with write exercise permissions token to exercise model.
Inline Arguments
- slug is string
The assembler slug
- task_no is integer
Integer number of the task for the specified assembler.
Arguments
- no is integer (Mandatory)
Integer number of the exercise for the specified assebler. Must be unique among the exercise number for the specified assember, and tasks, and contains only digits.
- committer_slug is string (Mandatory)
Slug of user, which is the exercise committer. The user MUST be presented.
- pkgname is string (Mandatory)
name of package for the exercise. The name MUST be presented.
- kind is string (Mandatory)
Kind of a resource, can of "repo", "srpm", "copy", "delete"
- resource is string (Optional)
Resource to build or copy from. Mandatory, when kind is of "repo", "srpm", or "copy", otherwise can be blank, defaulting to blank.
- sha is string (Optional)
Sha check sum of build commit, Mandatory, when kind is of "repo" or "srpm", otherwise can be blank, defaulting to blank.
- approver_slugs is array of string (Optional)
Array of the approver slugs, defaulting to empty array.
Examples
Example Request Url
POST:/v1/assembler/core/tasks/100000/exercises.json?no=100&kind=repo&pkgname=python-sphinx-objects&resource="http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git"&sha=0c4cd35c9f88f2a8bda272d9851089dd3e695845&committer_slug=user
Example Request Form
POST:/v1/assembler/core/tasks/100000/exercises.json DATA: { "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "approver_slugs": [], }
Example Good Response
Good response with created record:
{ "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "task_no": 100000, "assembler_slug": "core", "source_path_slug": "sisyphus_core", "approver_slugs": [], }
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/assembler/<slug>/tasks/<task_no>/exercises/<no>.json
Gets properties of the exercise 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.
Inline Arguments
- slug is string
The assembler slug
- task_no is integer
Integer number of the task for the specified assembler.
- no is integer
Integer number of the exercise for the specified assembler and task.
Arguments
This method requires NO arguments.
Examples
Example Request Url
GET:/v1/assembler/core/tasks/100000/exercises/100.json
Example Good Response
Good response with returned record:
{ "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "task_no": 100000, "assembler_slug": "core", "source_path_slug": "sisyphus_core", "approver_slugs": [], }
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/assembler/<slug>/tasks/<task_no>/exercises/<no>.json
Overwrites one or many specified only properties of the exercise specified by <name> URI-parameter, and returns updated state as JSON. Added into API v1.0.
Authentication
This method requires write authentication with write exercise token to exercise model.
Inline Arguments
- slug is string
The assembler slug
- task_no is integer
Integer number of the task for the specified assembler.
- no is integer
Integer number of the exercise for the specified assembler and task.
Arguments
- committer_slug is string (Mandatory)
Slug of user, which is the exercise committer. The user MUST be presented.
- pkgname is string (Mandatory)
name of package for the exercise. The name MUST be presented.
- kind is string (Mandatory)
Kind of a resource, can of "repo", "srpm", "copy", "delete"
- resource is string (Optional)
Resource to build or copy from. Mandatory, when kind is of "repo", "srpm", or "copy", otherwise can be blank, defaulting to blank.
- sha is string (Optional)
Sha check sum of build commit, Mandatory, when kind is of "repo" or "srpm", otherwise can be blank, defaulting to blank.
- approver_slugs is array of string (Optional)
Array of the approver slugs, defaulting to empty array.
Examples
Example Request Url
PATCH:/v1/assembler/core/tasks/100000/exercises/100.json?committer_slug=user1
Example Request Form
PATCH:/v1/assembler/core/tasks/100000/exercises/100.json DATA: { "committer_slug": "user1", "approver_slugs": [ "user2" ], }
Example Good Response
Good response with updated record:
{ "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "task_no": 100000, "assembler_slug": "core", "source_path_slug": "sisyphus_core", "approver_slugs": [ "user2" ], }
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/assembler/<slug>/tasks/<task_no>/exercises/<no>.json
Destroys the exercise 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 exercise token to exercise model.
Inline Arguments
- slug is string
The assembler slug
- task_no is integer
Integer number of the task for the specified assembler.
- no is integer
Integer number of the exercise for the specified assembler and task.
Arguments
This method requires NO arguments.
Examples
Example Request Url
DELETE:/v1/assembler/core/tasks/100000/exercises/100.json
Example Good Response
Good response returning deleted record:
{ "no": "100", "kind": "repo", "pkgname": "python-sphinx-objects", "resource": "http://git.altlinux.org/people/cronbuild/packages/python-sphinx-objects.inv.git", "sha": "0c4cd35c9f88f2a8bda272d9851089dd3e695845", "committer_slug": "user", "task_no": 100000, "assembler_slug": "core", "source_path_slug": "sisyphus_core", "approver_slugs": [], }
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.