Vridlo/api/vridlo.assemblers: Difference between revisions

From ALT Linux Wiki
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
== vridlo.assembler.slug ==
== vridlo.assemblers ==


This allows accessing to the specified assember record by <slug> URI-parameter. Added into API v1.0.
It allows accessing to a list of assemblers, 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 [[Vridlo/types/Assembler|Assembler]] structure.


=== Path ===
=== GET:/v1/assemblers.json ===


/v1/assemblers/<slug>
Returns a list of assemblers, which are presented in the system. Do not poll this method more than once an hour.
Added into API v1.0.


=== Methods ===
==== Authentication ====


==== POST ====
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/assemblers.json?name=/Assembler/
 
===== Example Good Response =====
 
[
    {
      "slug": "ca",
      "name": "Core Assembler"
      "host": "assembler.altlinux.org"
      "source_path_count": 3
      "export_path_base": "/export/path/to"
    },
    {
      "slug": "sa",
      "name": "Secondary Assembler"
      "host": "secondary.altlinux.org"
      "source_path_count": 1
      "export_path_base": "/export/path/to/sec/"
    }
]
 
===== 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/assemblers.json ===


Creates the assembler specified by <slug> URI-parameter using he set of properties passed as form data or get parameter array, and returns state of the created record as JSON.
Creates the assembler specified by <slug> URI-parameter using he 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 =====
==== Authentication ====


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


===== Arguments =====
==== Arguments ====


* slug (Mandatory)
* slug (Mandatory)
Line 28: Line 90:
  File path base for exporting of the source or built RPMs.
  File path base for exporting of the source or built RPMs.


===== Example Response =====
==== Examples ====
===== Example Request Url =====
 
POST:/v1/assemblers.json?name=assembler_name&slug=asse
 
===== Example Request Form =====
 
POST:/v1/assemblers.json
DATA:
{
  "slug": "ca",
  "name": "Core Assembler",
  "host": "assembler.altlinux.org",
  "export_path_base": "/export/path/to",
}
 
===== Example Good Response =====


Good response with created record:
Good response with created record:


  [
  {
  {
   "slug": "ca",
   "slug": "ca",
   "name": "Core Assembler"
   "name": "Core Assembler",
   "host": "assembler.altlinux.org"
   "host": "assembler.altlinux.org",
   "source_path_count": 0
   "source_path_count": 0,
   "export_path_base": "/export/path/to"
   "export_path_base": "/export/path/to",
  }
}
]
 
===== Example Bad Response =====


Error response ''423'':
Error response ''422'':


  [
  {
  {
   "error_code": 3,
   "error_code": 3
  "message": "Error text according the active language",
  }
  }
  ]


===== Return Codes =====
===== Return Codes =====
Line 55: Line 132:
  The resource wasn't found, and was created. Returned data responds to the current state of the resource.
  The resource wasn't found, and was created. Returned data responds to the current state of the resource.


* '''423.3''' (''SSL is required'')
* '''422.3''' (''SSL is required'')
  SSL is required to access the Vridlo API.
  SSL is required to access the Vridlo API.


Line 64: Line 141:
  The Internal Server Error has occurred.
  The Internal Server Error has occurred.


==== GET ====
=== GET:/v1/assemblers/<slug>.json ===


Gets properties of the assembler specified by <slug> URI-parameter, and returns then as JSON. Do not poll this method more than once an hour.
Gets properties of the assembler specified by <slug> URI-parameter, and returns then as JSON. Do not poll this method more than once an hour. Added into API v1.0.


===== Authentication =====
==== Authentication ====


This method requires NO authentication.
This method requires NO authentication.


===== Arguments =====
==== Arguments ====


This method requires NO arguments.
This method requires NO arguments.


===== Example Response =====
==== Examples ====
===== Example Request Url =====
 
GET:/v1/assemblers/ca.json
 
===== Example Good Response =====


Good response:
Good response with the returned record:


  [
  {
  {
   "slug": "ca",
   "slug": "ca",
   "name": "Core Assembler"
   "name": "Core Assembler"
Line 87: Line 168:
   "source_path_count": 3
   "source_path_count": 3
   "export_path_base": "/export/path/to"
   "export_path_base": "/export/path/to"
  }
}
]
 
===== Example Bad Response =====


Error response ''423'':
Error response ''422'':


  [
  {
  {
   "error_code": 3,
   "error_code": 3
  "message": "Error text according the active language",
  }
  }
  ]


===== Return Codes =====
==== Return Codes ====


* '''200''' (''OK'')
* '''200''' (''OK'')
  The resource was found and is accessible. Returned data responds to the current state of the resource.
  The resource was found and is accessible. Returned data responds to the current state of the resource.


* '''423.3''' (''SSL is required'')
* '''422.3''' (''SSL is required'')
  SSL is required to access the Vridlo API.
  SSL is required to access the Vridlo API.


Line 112: Line 193:
  The Internal Server Error has occurred.
  The Internal Server Error has occurred.


==== PUT/PATCH ====
=== PATCH:/v1/assemblers/<slug>.json ===


Sets one or many properties of the assembler specified by <slug> URI-parameter, and returns updated state as JSON.
Sets one or many properties of the assembler specified by <slug> URI-parameter, and returns updated state as JSON. Added into API v1.0.


===== Authentication =====
==== Authentication ====


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


===== Arguments =====
==== Arguments ====
 
'''NOTE:''' Blank fields will be skipped


* slug (Mandatory)
Slug of the assembler. Must be unique per system.
* name (Optional)
* name (Optional)
  Name of the assembler. If presented it must be unique among the assemblers.
  Name of the assembler. If presented it must be unique among the assemblers.
Line 131: Line 212:
  File path base for exporting of the source or built RPMs.
  File path base for exporting of the source or built RPMs.


===== Example Request =====
==== Examples ====
===== Example Request Url =====


/v1/assemblers/ca?name=Core_Assembler
PATCH:/v1/assemblers/ca.json?name=Core_Assembler


===== Example Response =====
===== Example Request Form =====


Good response:
PATCH:/v1/assemblers/ca.json
DATA:
{
  "name": "Core_Assembler",
}


  [
===== Example Good Response =====
  {
 
  {
   "slug": "ca",
   "slug": "ca",
   "name": "Core Assembler"
   "name": "Core Assembler"
Line 146: Line 233:
   "source_path_count": 3
   "source_path_count": 3
   "export_path_base": "/export/path/to"
   "export_path_base": "/export/path/to"
  }
}
]
 
===== Example Bad Response =====


Error response ''423'':
Error response ''422'':


  [
  {
  {
   "error_code": 3,
   "error_code": 3
  "message": "Error text according the active language",
  }
  }
  ]


===== Return Codes =====
==== Return Codes ====


* '''200''' (''OK'')
* '''200''' (''OK'')
Line 165: Line 252:
  The resource was found and is accessible. But no changes were made on the resource.
  The resource was found and is accessible. But no changes were made on the resource.


* '''423.3''' (''SSL is required'')
* '''422.3''' (''SSL is required'')
  SSL is required to access the Vridlo API.
  SSL is required to access the Vridlo API.


Line 174: Line 261:
  The Internal Server Error has occurred.
  The Internal Server Error has occurred.


==== DELETE ====
=== DELETE:/v1/assemblers/<slug>.json ===


Destroys the assembler specified by <slug> URI-parameter, and returns state of the destroyed record as JSON.
Destroys the assembler specified by <slug> URI-parameter, and returns state of the destroyed record as JSON. Added into API v1.0.


===== Authentication =====
==== Authentication ====


This method requires write authentication with write permission to assembler model.
This method requires write authentication with '''write''' permission token to ''assembler'' model.


===== Arguments =====
==== Arguments ====


This method requires NO arguments.
This method requires NO arguments.


===== Example Response =====
==== Examples ====
===== Example Request Url =====
 
DELETE:/v1/assemblers/ca.json
 
===== Example Good Response =====


Good response returning deleted record:
Good response returning deleted record:


  [
  {
  {
   "slug": "ca",
   "slug": "ca",
   "name": "Core Assembler"
   "name": "Core Assembler"
Line 197: Line 288:
   "source_path_count": 3
   "source_path_count": 3
   "export_path_base": "/export/path/to"
   "export_path_base": "/export/path/to"
  }
}
]
 
===== Example Bad Response =====


Error response ''423'':
Error response ''422'':


  [
  {
  {
   "error_code": 3,
   "error_code": 3
  "message": "Error text according the active language",
  }
  }
  ]


===== Return Codes =====
==== Return Codes ====


* '''200''' (''OK'')
* '''200''' (''OK'')
  The resource was found and is accessible, and successfully destroyed. Returned data responds to the state of the destroyed resource.
  The resource was found and is accessible, and successfully destroyed. Returned data responds to the state of the destroyed resource.


* '''423.3''' (''SSL is required'')
* '''422.3''' (''SSL is required'')
  SSL is required to access the Vridlo API.
  SSL is required to access the Vridlo API.



Latest revision as of 11:09, 3 December 2019

vridlo.assemblers

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

GET:/v1/assemblers.json

Returns a list of assemblers, 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/assemblers.json?name=/Assembler/
Example Good Response
[
   {
      "slug": "ca",
      "name": "Core Assembler"
      "host": "assembler.altlinux.org"
      "source_path_count": 3
      "export_path_base": "/export/path/to"
   },
   {
      "slug": "sa",
      "name": "Secondary Assembler"
      "host": "secondary.altlinux.org"
      "source_path_count": 1
      "export_path_base": "/export/path/to/sec/"
   }
]
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/assemblers.json

Creates the assembler specified by <slug> URI-parameter using he 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 to assembler model.

Arguments

  • slug (Mandatory)
Slug of the assembler. Must be unique per system.
  • name (Mandatory)
Name of the assembler. Must be unique among the assemblers.
  • host (Optional)
Host URI of the assembler. If presented it must be unique among the assemblers.
  • export_path_base (Optional)
File path base for exporting of the source or built RPMs.

Examples

Example Request Url
POST:/v1/assemblers.json?name=assembler_name&slug=asse
Example Request Form
POST:/v1/assemblers.json
DATA:
{
  "slug": "ca",
  "name": "Core Assembler",
  "host": "assembler.altlinux.org",
  "export_path_base": "/export/path/to",
}
Example Good Response

Good response with created record:

{
  "slug": "ca",
  "name": "Core Assembler",
  "host": "assembler.altlinux.org",
  "source_path_count": 0,
  "export_path_base": "/export/path/to",
}
Example Bad Response

Error response 422:

{
  "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.
  • 404 (Not Found)
The record with provided slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.

GET:/v1/assemblers/<slug>.json

Gets properties of the assembler specified by <slug> 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/assemblers/ca.json
Example Good Response

Good response with the returned record:

{
  "slug": "ca",
  "name": "Core Assembler"
  "host": "assembler.altlinux.org"
  "source_path_count": 3
  "export_path_base": "/export/path/to"
}
Example Bad Response

Error response 422:

{
  "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/assemblers/<slug>.json

Sets one or many properties of the assembler specified by <slug> URI-parameter, and returns updated state as JSON. Added into API v1.0.

Authentication

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

Arguments

NOTE: Blank fields will be skipped
  • name (Optional)
Name of the assembler. If presented it must be unique among the assemblers.
  • host (Optional)
Host URI of the assembler. If presented it must be unique among the assemblers.
  • export_path_base (Optional)
File path base for exporting of the source or built RPMs.

Examples

Example Request Url
PATCH:/v1/assemblers/ca.json?name=Core_Assembler
Example Request Form
PATCH:/v1/assemblers/ca.json
DATA:
{
  "name": "Core_Assembler",
}
Example Good Response
{
  "slug": "ca",
  "name": "Core Assembler"
  "host": "assembler.altlinux.org"
  "source_path_count": 3
  "export_path_base": "/export/path/to"
}
Example Bad Response

Error response 422:

{
  "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.
  • 404 (Not Found)
The record with provided id/slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.

DELETE:/v1/assemblers/<slug>.json

Destroys the assembler specified by <slug> 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 assembler model.

Arguments

This method requires NO arguments.

Examples

Example Request Url
DELETE:/v1/assemblers/ca.json
Example Good Response

Good response returning deleted record:

{
  "slug": "ca",
  "name": "Core Assembler"
  "host": "assembler.altlinux.org"
  "source_path_count": 3
  "export_path_base": "/export/path/to"
}
Example Bad Response

Error response 422:

{
  "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.