Vridlo/api/vridlo.rpms

From ALT Linux Wiki
< Vridlo/api
Revision as of 15:01, 3 December 2019 by Majioa (talk | contribs)

vridlo.rpms

It allows accessing to a list of rpms, 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 Rpm structure.

GET:/v1/rpms.json

Returns a list of rpms, 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.

Examples

Example Request Url
GET:/v1/rpms.json?name=/Core/
Example Good Response
[
   {
      "id": "100001",
      "name": "ruby",
      "epoch": "1",
      "version": "2.5.5",
      "release": "alt1",
      "arch": "i586",
      "built_at": "10.10.10 10:10:10",
      "group_id": 100,
      "md5": "236abd7880b4577f2b9470c09fee79d6",
      "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
      "size": "100000",
      "builder_id": 1000,
      "src_id": 100000,
      "repo_status": "skip",
      "descriptions": [
         {
            text: "ruby package",
           language: "en",
            alphabeth: "en",
         },
         {
            text: "руби пакет",
            language: "ru",
            alphabeth: "ru",
        },
      ]
   },
   {
      "id": "100000",
      "name": "ruby",
      "epoch": "1",
      "version": "2.5.5",
      "release": "alt1",
      "arch": "src",
      "built_at": "10.10.10 10:10:10",
      "group_id": 100,
      "md5": "236abd7880b4577f2b9470c09fee79d6",
      "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
      "size": "100000",
      "builder_id": 1000,
      "repo_status": "skip",
   },
]
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/rpms.json

Creates the rpm 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 to rpm model.

Arguments

  • name is string mandatory
Unique name of the rpm. Can be renamed with a notification.
  • epoch is natural optional
Epoch number of the rpm build.
  • version is string mandatory
Version of the rpm build. Usually is is represented as a number.
  • release is string mandatory
Release of the rpm build. Usually is is represented as a number.
  • arch is string mandatory
Architecture slug name of the rpm build. Must be presented in the system. It represents slug link to Arch structure.
  • built_at is string mandatory
Rpm is built at time.
  • builder_slug is string mandatory
Slug name of the RPM builder, represents User structure.
  • group_id is natural mandatory
Represented as a natural number the group identifier which the rpm belongs to.
  • sha is string mandatory
Sha of rpm file containment.
  • size is string mandatory
Size of the rpm file.
  • src_id is string optional
Id of the source repo. Must be valid if arch is not "src", or blank if arch is "src".
  • descriptions is Lorem array optional
Array of descriptions of the rpm, text of which is stored in the UTF-8 encoding, and language, and alphabeth are autodetected or inferred from encoding. It represents Lorem structure.

Examples

Example Request Url
POST:/v1/rpms.json?name=Core Assembler Source Path&slug=sp&assembler_slug=ca&repo=p9&arch=i586&relative_path=p9/i586
Example Request Form
POST:/v1/rpms.json
DATA:

}

Example Good Response

Good response with created record:

{
   "name": "ruby",
   "epoch": "1",
   "version": "2.5.5",
   "release": "alt1",
   "arch": "src",
   "built_at": "10.10.10 10:10:10",
   "group_id": 100,
   "md5": "236abd7880b4577f2b9470c09fee79d6",
   "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
   "size": "100000",
   "builder_id": 1000,
   "repo_status": "skip",
   "descriptions": [
      {
         text: "ruby package",
         language: "en",
         alphabeth: "en",
      },
      {
         text: "руби пакет",
         language: "ru",
         alphabeth: "ru",
      },
   ]
}
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/rpms/<slug>.json

Gets properties of the rpm 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": 100000,
  "name": "ruby",
  "epoch": "1",
  "version": "2.5.5",
  "release": "alt1",
  "arch": "i586",
  "built_at": "10.10.10 10:10:10",
  "description": "ruby package",
  "group_id": 100,
  "group_name": "Development/Ruby",
  "md5": "236abd7880b4577f2b9470c09fee79d6",
  "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
  "size": "100000",
  "builder_name": "Ruby Builder Bot",
  "builder_id": 1000,
  "src_id": 100000,
  "repo_status": "skip",
 }
]
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/rpms/<slug>.json

Sets one or many properties of the rpm specified by <slug> URI-parameter, and returns updated state as JSON.

Authentication

This method requires write authentication with write permission to rpm model.

Arguments

  • id (Mandatory)
Id of the rpm.
  • name (Mandatory)
Name of the rpm.
  • epoch (Optional)
Epoch of the rpm build.
  • version (Mandatory)
Version of the rpm build. Must be valid.
  • release (Mandatory)
Release of the rpm build. Must be valid.
  • arch (Mandatory)
Arch of the rpm build. Must be valid.
  • description (Optional)
Description of the rpm.
  • built_at (Mandatory)
Rpm Built at time. Must be valid.
  • group_id (Mandatory)
Group Id which the rpm is belong to. Must be valid.
  • sha (Mandatory)
Sha of rpm file. Must be valid.
  • size (Mandatory)
Size of the rpm.
  • builder_id (Mandatory)
Id of the builder. Must be valid.
  • src_id (Optional)
Id of the source repo. Must be valid if arch is not "src", or blank if arch is "src".
  • repo_status (Optional)
Status of validation the package by a repocop.
Example Request

PUT:/v1/rpms/ca?name=Core_Assembler

Example Response

Good response:

[
 {
  "id": 100000,
  "name": "ruby",
  "epoch": "1",
  "version": "2.5.5",
  "release": "alt1",
  "arch": "i586",
  "built_at": "10.10.10 10:10:10",
  "description": "ruby package",
  "group_id": 100,
  "md5": "236abd7880b4577f2b9470c09fee79d6",
  "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
  "size": "100000",
  "builder_id": 1000,
  "src_id": 100000,
  "repo_status": "skip",
 }
]
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/rpms/<slug>.json

Destroys the rpm specified by <slug> URI-parameter, and returns state of the destroyed record as JSON.

Authentication

This method requires write authentication with write permission to rpm model.

Arguments

This method requires NO arguments.

Example Response

Good response returning deleted record:

[
 {
  "id": 100001,
  "name": "ruby",
  "epoch": "1",
  "version": "2.5.5",
  "release": "alt1",
  "arch": "src",
  "built_at": "10.10.10 10:10:10",
  "description": "ruby package",
  "group_id": 100,
  "group_name": "Development/Ruby",
  "md5": "236abd7880b4577f2b9470c09fee79d6",
  "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
  "size": "100000",
  "builder_name": "Ruby Builder Bot",
  "builder_id": 1000,
  "repo_status": "skip",
 }
]
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.