Platforms API

Get a single platform

GET /api/v1/platforms/:id.json

Parameters:

id
Integer identifier of current platform

Response:

{
  "platform": {
    "id": "platform id",
    "name": "platform name",
    "description": "platform description",
    "parent_platform_id": "parent platform id",
    "created_at": "platform created at",
    "updated_at": "platform updated_at",
    "released": "platform released",
    "visibility": "platform visibility",
    "platform_type": "platform type",
    "distrib_type": "platform distribution type",
    "default_branch": "platform default branch",
    "owner": {
      "id": "owner id",
      "name": "owner name",
      "type": "owner type",
      "url": "owner data path"
    },
    "repositories": [
      {
        "id": "repository for package storage id",
        "name": "repository for package storage name",
        "url": "path to repository data page"
      }
    ],
    "products": [
      {
        "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"
      }
    ],
    "url": "platform path"
  }
}

Example:

{
  "platform": {
    "id": 1,
    "name": "mdv",
    "description": "mdv_main",
    "parent_platform_id": null,
    "created_at": "1326990586",
    "updated_at": "1337171843",
    "released": true,
    "visibility": "open",
    "platform_type": "main",
    "distrib_type": "mdv",
    "default_branch": "master",
    "owner": {
      "id": 5,
      "name": "Timothy Bobrov",
      "type": "User",
      "url": "/api/v1/users/5.json"
    },
    "repositories": [
      {
        "id": 1,
        "name": "main",
        "url": "/api/v1/repositories/1.json"
      },
      {
        "id": 2,
        "name": "release",
        "url": "/api/v1/repositories/2.json"
      }
    ],
    "products": [
      {
        "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"
      }
    ],
    "url": "/api/v1/platforms/1.json"
  }
}

Update a single platform

PUT /api/v1/platforms/:id.json

Parameters:

id
Required Integer identifier of current platform

Input:

default_branch:
Optional String default branch of platform
description:
Optional String platform description
released:
Optional Boolean realise status of platform
owner_id:
Optional Integer identifier of platform owner

Request:

{
  "platform": {
    "default branch": "new_branch",
    "description": "new description",
    "released": true,
    "owner_id": 1
  }
}

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Example:

{
  "platform": {
    "id": 56,
    "message": "Platform has been updated successfully"
  }
}

Members of a single platform

GET /api/v1/platforms/:id/members.json

Parameters:

id
Required Integer identifier of current platform

Request example:

/api/v1/platforms/53/members.json

Response:

{
  "platform": {
    "id": "platform id",
    "members": [
      {
        "id": "member id",
        "type": "User or Group type of member",
        "url": "member path"
      }
    ]
  },
  "url": "members path"
}

Example:

{
  "platform": {
    "id": 77,
    "members": [
      {
        "id": 31,
        "type": "User",
        "url": "/api/v1/users/31.json"
      },
      {
        "id": 22,
        "type": "Group",
        "url": "/api/v1/groups/31.json"
      }
    ]
  },
  "url": "/api/v1/platforms/77/members.json"
}

Add member to a single platform

PUT /api/v1/platforms/:id/add_member.json

Parameters:

id
Required Integer identifier of current platform

Input:

member_id
Required Integer identifier of new member
type
Required String Group or User type of new member

Request:

{
  "member_id": 34,
  "type": "User"
}

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "User '32' has been added to platform successfully"
  }
}

 

{
  "platform": {
    "id": 56,
    "message": "Group '31' has been added to platmorm successfully"
  }
}

Remove member from a single platform

DELETE /api/v1/platforms/:id/remove_member.json

Parameters:

id
Required Integer identifier of current platform

Input:

member_id
Required Integer identifier of member
type
Required String Group or User type of member

Request:

{
  "member_id": 34,
  "type": "User"
}

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "User '32' has been removed from platform successfully"
  }
}

 

{
  "platform": {
    "id": 56,
    "message": "Group '31' has been removed from platform successfully"
  }
}

Clone a single platform

POST /api/v1/platforms/:id/clone.json

Parameters:

id
Required Integer identifier of current platform

Input:

description:
Required String platform description
name:
Required String platform name
default_branch:
Required String default branch of platform

Request:

{
  "platform": {
    "default_branch": "master",
    "description": "platform description",
    "name": "platform name"
  }
}

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "Platform has been cloned successfully"
  }
}

Clear a single platform

Only for personal platforms!

PUT /api/v1/platforms/:id/clear.json

Parameters:

id
Required Integer identifier of current platform

Request example:

/api/v1/platforms/54/clear.json

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "Platform has been cleared successfully"
  }
}

Create platform

POST /api/v1/platforms.json

Input:

name:
Required String platform name
default_branch:
Required String default branch of platform
description:
Required String platform description
distrib_type:
Required String distrib_type of platform (mdv or rhel)
released:
Optional Boolean realise status of platform
owner_id:
Optional Integer identifier of platform owner

Request:

{
  "platform": {
    "default branch": "new_branch",
    "description": "new description",
    "released": true,
    "owner_id": 1,
    "name": "distrib_type",
    "distrib_type": "mdv"
  }
}

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "Platform has been created successfully"
  }
}

Destroy platform

Only for main platforms!

DELETE /api/v1/platforms/:id.json

Parameters:

id
Required Integer identifier of current platform

Request example:

/api/v1/platforms/54.json

Response:

{
  "platform": {
    "id": "platform id (null if failed)",
    "message": "success or fail message"
  }
}

Examples:

{
  "platform": {
    "id": 56,
    "message": "Platform has been destroyed successfully"
  }
}

List platforms

List all platforms across all the authenticated user’s platforms including owned platforms, member platforms, and group platforms.

GET /api/v1/platforms.json

Parameters:

type
Optional filter platforms by type: main or personal. Also you can don’t set the type to get all of the platforms

Request examples:

/api/v1/platforms.json?type=main
/api/v1/platforms.json?type=personal
/api/v1/platforms.json

Response:

{
  "platforms": [
    {
      "id": "platform id",
      "name": "platform name",
      "platform_type": "platform type(main/personal)",
      "visibility": "platform visibility (hidden/open)",
      "owner": {
        "id": "owner id",
        "name": "owner name",
        "type": "owner type",
        "url": "path to owner data"
      },
      "repositories": [
        {
          "id": "repository for package storage id",
          "name": "repository for package storage name",
          "url": "path to repository data page"
        }
      ],
      "url": "path to platform data"
    }
  ],
  "url": "path to platforms data"
}

Example:

{
  "platforms": [
    {
      "id": 16,
      "name": "rosa2012",
      "platform_type": "main",
      "visibility": "open",
      "owner": {
        "id": 5,
        "name": "Timothy Bobrov1",
        "type": "User",
        "url": "/api/v1/users/5.json"
      },
      "repositories": [
        {
          "id": 26,
          "name": "main",
          "url": "/api/v1/repositories/26.json"
        },
        {
          "id": 27,
          "name": "contrib",
          "url": "/api/v1/repositories/27.json"
        }
      ],
      "url": "/api/v1/platforms/26.json"
    },
    {
      "id": 18,
      "name": "timothy_tsvetkov",
      "platform_type": "main",
      "visibility": "open",
      "owner": {
        "id": 4,
        "name": "Yaroslav Garkin",
        "type": "User",
        "url": "/api/v1/users/4.json"
      },
      "repositories": [
        {
          "id": 30,
          "name": "main",
          "url": "/api/v1/repositories/30.json"
        },
        {
          "id": 31,
          "name": "non-free",
          "url": "/api/v1/repositories/31.json"
        }
      ],
      "url": "/api/v1/platforms/18.json"
    },
    {
      "id": 17,
      "name": "timothy_bobrov_personal",
      "platform_type": "personal",
      "visibility": "open",
      "owner": {
        "id": 5,
        "name": "Timothy Bobrov",
        "type": "User",
        "url": "/timothy_bobrov.json"
      },
      "repositories": [
        {
          "id": 28,
          "name": "main",
          "url": "/api/v1/repositories/28.json"
        }
      ],
      "url": "/api/v1/platforms/17.json"
    }
  ],
  "url": "/api/v1/platforms.json"
}

List of platforms for which you can create build list.

This data required for api Сreate build list.

GET /api/v1/platforms/platforms_for_build.json

Request examples:

/api/v1/platforms/platforms_for_build.json

Response:

{
  "platforms": [
    {
      "id": "platform id",
      "name": "platform name",
      "platform_type": "platform type(only main for build task)",
      "visibility": "platform visibility (only open if the current user is anonymous)",
      "owner": {
        "id": "owner id",
        "name": "owner name",
        "type": "owner type",
        "url": "path to owner data"
      },
      "repositories": [
        {
          "id": "repository for package storage id",
          "name": "repository for package storage name",
          "url": "path to repository data page"
        }
      ],
      "url": "path to platform data"
    }
  ],
  "url": "path to platforms data"
}

Example:

{
  "platforms": [
    {
      "id": 16,
      "name": "rosa2012",
      "platform_type": "main",
      "visibility": "open",
      "owner": {
        "id": 5,
        "name": "Timothy Bobrov1",
        "type": "User",
        "url": "/api/v1/users/5.json"
      },
      "repositories": [
        {
          "id": 26,
          "name": "main",
          "url": "/api/v1/repositories/26.json"
        },
        {
          "id": 27,
          "name": "contrib",
          "url": "/api/v1/repositories/27.json"
        }
      ],
      "url": "/api/v1/platforms/26.json"
    },
    {
      "id": 18,
      "name": "timothy_tsvetkov",
      "platform_type": "main",
      "visibility": "open",
      "owner": {
        "id": 4,
        "name": "Yaroslav Garkin",
        "type": "User",
        "url": "/api/v1/users/4.json"
      },
      "repositories": [
        {
          "id": 30,
          "name": "main",
          "url": "/api/v1/repositories/30.json"
        },
        {
          "id": 31,
          "name": "non-free",
          "url": "/api/v1/repositories/31.json"
        }
      ],
      "url": "/api/v1/platforms/18.json"
    }
  ],
  "url": "/api/v1/platforms/platforms_for_build.json"
}