Vridlo/api/vridlo.files

From ALT Linux Wiki
< Vridlo/api
Revision as of 17:29, 28 November 2019 by Majioa (talk | contribs) (Created page with "== vridlo.files == It allows accessing to a list of files, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0. It implemen...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

vridlo.files

It allows accessing to a list of files, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0. It implements operation on the File structure.

GET:/v1/files.json

Returns a list of files, 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/files.json
Example Good Response
[
  {
    "id": 1,
    "description": "UTF-8 Unicode text",
    "mime_type": "text/plain",
    "mime_encoding": "utf-8",
    "sha": "1c14c6709815654918ca55ff92fb0eb98d3d590e8bf9fbeead80ac2b"
    "file_source_count": 2,
    "rpm_count": 2,
    "all_rpm_count": 3,
  }
]
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.

GET:/v1/files/<sha>.json

Gets properties of the file specified by <sha> SHA sum 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

  • sha is string[56] mandatory
SHA2 224 56-byted checksum over the file containment. Can be used as unique file index.

Arguments

This method requires NO arguments.

Examples

Example Request Url
GET:/v1/files/1c14c6709815654918ca55ff92fb0eb98d3d590e8bf9fbeead80ac2b
Example Good Response

Good response with the returned record:

{
   "id": 1,
   "description": "UTF-8 Unicode text",
   "mime_type": "text/plain",
   "mime_encoding": "utf-8",
   "sha": "1c14c6709815654918ca55ff92fb0eb98d3d590e8bf9fbeead80ac2b"
   "file_source_count": 2,
   "rpm_count": 2,
   "all_rpm_count": 3,
}
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.