Products API
Get a single product
- Available statuses for parameter “autostart_status”:
-
-
nil
— none, default value; -
0
— once a 12 hours - at 4am and 4pm; -
1
— once a day - at 4am; -
2
— once a week - at 4am sunday;
GET /api/v1/products/:id.json
-
Parameters:
- id
- Required Integer identifier of current product.
Response:
{
"product": {
"id": "resource id",
"name": "name",
"description": "description",
"main_script": "main script",
"params": "params for running script",
"time_living": "Max time for building (in minutes)",
"autostart_status": "status of autostart ISO builds",
"url": "url to product page",
"platform": {
"id": "platform id",
"name": "platform name",
"visibility": "platform visibility",
"platform_type": "platform type",
"url": "platform data page path"
},
"project": {
"id": "project id",
"name": "project name",
"visibility": "visibility (open/hidden)",
"fullname": "project fullname",
"url": "url to project data page",
"git_url": "path to project git",
"ssh_url": "path to project git over ssh",
"maintainer": {
"id": "user id",
"uname": "user uname",
"name": "user name",
"url": "api user path",
"email": "user email"
}
},
"created_at": "created at date and time",
"updated_at": "updated at date and time"
}
}
Example:
{
"product": {
"id": "1",
"name": "rosa2012lts_ee",
"description": "Extended Edition ROSA 2012 Marathon with non-free and restricted",
"main_script": "MATRIX",
"params": "lst=libs externalarch=\\\"x86_64\\\" PRODUCTNAME=ROSA.201...",
"time_living": "60",
"autostart_status": null,
"url": "/api/v1/products/10.json",
"platform": {
"id": 1,
"name": "rosa2012",
"visibility": "open",
"platform_type": "main",
"url": "/api/v1/platforms/1.json"
},
"project": {
"id": 666,
"name": "evil_tools",
"visibility": "open",
"fullname": "abf/evil_tools",
"url": "/api/v1/projects/666.json",
"git_url": "https:/ivan@abf.rosalinux.ru/jaroslav_garkin/hwinfo.git",
"ssh_url": "git@abf.rosalinux.ru:jaroslav_garkin/hwinfo.git",
"maintainer": {
"id": 1,
"name": "Ivan Aivazovsky",
"uname": "ivan_aivazovsky",
"url": "/api/v1/users/1.json",
"email": "ivan.aivazovsky@email.ru "
}
},
"created_at": "1348168705",
"updated_at": "1348168705"
}
}
Create product
POST /api/v1/products.json
Input:
- platform_id
- Required Integer identifier of platform.
- project_id
- Required Integer identifier of project.
- description:
- Optional String product description.
- name:
- Required String product name.
- main_script:
- Optional String main script.
- params:
- Optional String params for running script.
- time_living:
- Optional Integer Maximum time for building (between 2 and 720 minutes).
- autostart_status:
-
Optional Integer Autostart ISO builds on a regular basis. Default value:
nil
.
Request:
{
"product": {
"platform_id": 15,
"project_id": 100,
"name": "rosa2012lts_ee",
"description": "Extended Edition ROSA 2012 Marathon with non-free and restricted",
"main_script": "MATRIX",
"params": "lst=libs externalarch=\\\"x86_64\\\" PRODUCTNAME=ROSA.201...",
"time_living": 60,
"autostart_status": 0
}
}
Response:
{
"product": {
"id": "product id (null if failed)",
"message": "success or fail message"
}
}
Example:
{
"product": {
"id": 12,
"message": "Product has been created successfully"
}
}
Update a single product
PUT /api/v1/products/:id.json
Parameters:
- id
- Required Integer identifier of current product.
Input:
- project_id
- Optional Integer identifier of project.
- description:
- Optional String product description.
- name:
- Optional String product name.
- main_script:
- Optional String main script.
- params:
- Optional String params for running script.
- time_living:
- Optional Integer Maximum time for building (between 2 and 720 minutes).
- autostart_status:
- Optional Integer Autostart ISO builds on a regular basis.
Request:
{
"product": {
"project_id": 100,
"name": "rosa2012lts_ee",
"description": "Extended Edition ROSA 2012 Marathon with non-free and restricted",
"main_script": "MATRIX",
"params": "lst=libs externalarch=\\\"x86_64\\\" PRODUCTNAME=ROSA.201...",
"time_living": 60,
"autostart_status": 0
}
}
Response:
{
"product": {
"id": "product id (null if failed)",
"message": "success or fail message"
}
}
Example:
{
"product": {
"id": 12,
"message": "Product has been updated successfully"
}
}
Destroy product
DELETE /api/v1/products/:id.json
Parameters:
- id
- Required Integer identifier of current product.
Response:
{
"product": {
"id": "product id (null if failed)",
"message": "success or fail message"
}
}
Example:
{
"product": {
"id": 12,
"message": "Product has been destroyed successfully"
}
}