SUSE Studio User API
Version: v1
SUSE Studio offers a RESTful API which can be accessed entirely via HTTP.
Changes
- 21/09/2009
-
Added the following methods/resources
- /appliances/<id>/image_files
- /appliances/<id>/gpg_keys
- /appliances/<id>/cmd/ban_package
- /appliances/<id>/cmd/unban_package
- 25/08/2009
- Added /appliances/<id>/cmd/add_user_repository call
- 04/08/2009
- Added parameters to set the image type and version when starting builds
- 03/08/2009
-
The API got extended with the following resources and methods:
- /user/account
- /appliances/<id>/status
- /appliances/<id>/repositories
- /appliances/<id>/software
- /appliances/<id>/cmd
- /repositories
- 02/06/2009
- Added /rpms resource for managing uploaded RPMs
Authentication
The Studio API supports two different authentication methods:
HTTP Basic authentication
The credentials for this authentication method are the username and an API key as password, which the user can create and change at any time.
OAuth authentication
Note: OAuth authentication has been disabled until the security flaw in OAuth Core 1.0 has been addressed.
Table of Contents
- Account information
- Template sets
-
Appliances
- GET /api/v1/user/appliances
- GET /api/v1/user/appliances/<id>
- GET /api/v1/user/appliances/<id>/status
- POST /api/v1/user/appliances?clone_from=<appliance_id>&name=<name>&arch=<arch>
- DELETE /api/v1/user/appliances/<id>
- Repositories
-
Software Selection
- GET /api/v1/user/appliances/<id>/software
- PUT /api/v1/user/appliances/<id>/software
- GET /api/v1/user/appliances/<id>/software/installed?build_id=<build>
- POST /api/v1/user/appliances/<id>/cmd/add_package?name=<name>&version=<version>&repository_id=<repo_id>
- POST /api/v1/user/appliances/<id>/cmd/remove_package?name=<name>
- POST /api/v1/user/appliances/<id>/cmd/add_pattern?name=<name>&version=<version>&repository_id=<repo_id>
- POST /api/v1/user/appliances/<id>/cmd/remove_pattern?name=<name>
- POST /api/v1/user/appliances/<id>/cmd/ban_package?name=<name>
- POST /api/v1/user/appliances/<id>/cmd/unban_package?name=<name>
- GET /api/v1/user/appliances/<id>/software/search?q=<search_string>&all_fields=<all_fields>&all_repos=<all_repos>
- Image files
- GPG Keys
-
Overlay files
- GET /api/v1/user/files?appliance_id=<id>
- POST /api/v1/user/files?appliance_id=<id>&filename=<name>&path=<path>&owner=<owner>&group=<group>&permissions=<perms>&enabled=<enabled>
- GET /api/v1/user/files/<file_id>/data
- PUT /api/v1/user/files/<file_id>/data
- GET /api/v1/user/files/<file_id>
- PUT /api/v1/user/files/<file_id>
- DELETE /api/v1/user/files/<file_id>
- Running builds
- Finished builds
- RPM Uploads
- Repositories
Account information
Returns an HTML page which contains the API key flagged as:
<span class="studio:api_key">ksdjfu93r</span>.
Returns information about the account, such as username, email address and disk quota.
Result: Example
Template sets
List all template sets. Template sets are used to group available templates by topic. The 'default' template set contains all vanilla SUSE templates, 'mono' contains those that are optimized to be used for mono applications, for example.
Result: Example
Arguments:
- name - Name of template
Show template set name.
Result: Example
Appliances
List all appliances of the current user.
Result: Example
Arguments:
- id - Id of the appliance
Show details of appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
Show information on the status of the appliance with id id.
Result: Example
Arguments:
- clone_from - The template the new appliance should be based on.
- name (optional) - The name of appliance
- arch (optional) - The architecture of the appliance (x86_64 or i686)
Create a new appliance by cloning a template or another appliance with the id appliance_id. If name is left out, a name will be generated. If arch is left out a i686 appliance will be created.
Arguments:
- id - Id of the appliance
Delete appliance with id id.
Repositories
Arguments:
- id - Id of the appliance
List all repositories of the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
Update the list of repositories of the appliance with id id.
Note: Only the repository ids of the put xml are considered.
Result: Example
Arguments:
- id - Id of the appliance
- repo_id - Id of the repository.
Add the specified repository to the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- repo_id - Id of the repository.
Remove the specified repository from the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
Adds the according user repository (the one containing the uploaded RPMs) to the appliance.
Software Selection
Arguments:
- id - Id of the appliance
List all selected packages and patterns of the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
Update the list of selected packages and patterns of the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- build_id (optional) - Id of the build.
List all packages and patterns that are installed. You can either specify the appliance with the appliance_id parameter, which will list the software that will installed with the next build or via an build id. That makes it possible to retrieve the installed software for older builds.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the package.
- version (optional) - Version of the package.
- repository_id (optional) - Repository to pick the package from.
Add the specified package to the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the package.
Remove the specified package from the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the pattern.
- version (optional) - Version of the pattern.
- repository_id (optional) - Repository to pick the pattern from.
Add the specified pattern to the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the pattern.
Remove the specified pattern from the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the package.
Ban a package from the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- name - Name of the package.
Unban a package from the appliance with id id.
Result: Example
Arguments:
- id - Id of the appliance
- q - The search string
- all_fields (optional) - Option to perform the search on all fields. Default is 'false'.
- all_repos (optional) - Option to perform the search on all repositories. Default is 'false'.
Search all software that matches the given search_string. If the all_fields parameter is set to true all fields are considered, otherwise only the name of the package or pattern is matched against the search_string. By default only software that is available to the appliance is considered, e.g. the search is limited to the repositories of this appliances. If you want to search in all repositories set the all_repos parameter to true.
Result: Example
Image files
Arguments:
- id - Id of the appliance.
- build_id - Id of the build.
- path - Path to the file in the built appliance.
Returns the file with the given path from an image.
GPG Keys
SUSE Studio allows to upload GPG keys that will be imported when the appliance is built.
Arguments:
- id - Id of the appliance.
Lists all GPG keys of the appliance with the id id.
Result: Example
Arguments:
- id - Id of the appliance.
- key_id - Id of the GPG key.
Shows information on the GPG key with the id key_id.
Result: Example
Arguments:
- id - Id of the appliance.
- name - A name for the key.
- target - The target specifies in which keyring the key will be importet. Possible values are: 'rpm'.
- key (optional) - The URL encoded key.
Uploads a GPG key to the appliance with the id id. The key can either be given as the key parameter or wrapped as with form-based file uploads in HTML (RFC 1867) in the body of the POST request. The key will be imported into the keyring that is specified in the target parameter.
Result: Example
Arguments:
- id - Id of the appliance.
- key_id - Id of the GPG key.
Deletes the GPG key with the id key_id from the appliance.
Overlay files
Arguments:
- appliance_id - Id of the appliance.
List all overlay files of appliance with id id.
Result: Example
Arguments:
- appliance_id - Id of the appliance.
- filename (optional) - The name of the file in the filesystem.
- path (optional) - The path where the file will be stored.
- owner (optional) - The owner of the file.
- group (optional) - The group of the file.
- permissions (optional) - The permissions of the file.
- enabled (optional) - Used to enable/disable this file for the builds.
Adds a file to the appliance with id id. Optionally, one or more metadata settings can be specified. If those are left out, they can also be change later (see below). The file is expected to be wrapped as with form-based file uploads in HTML (RFC 1867) in the body of the POST request.
Result: Example
Arguments:
- file_id - Id of the file.
Returns the file with id file_id.
Arguments:
- file_id - Id of the file.
Writes the content of the file with id file_id. The file is expected to be wrapped as with form-based file uploads in HTML (RFC 1867) in the body of the PUT request.
Result: Example
Arguments:
- file_id - Id of the file.
Returns the meta data of the file with id file_id.
Result: Example
Arguments:
- file_id - Id of the file.
Writes the meta data of the file with id file_id.
Result: Example
Arguments:
- file_id - Id of the file.
Delete the file with id file_id and its meta data.
Running builds
Arguments:
- appliance_id - Id of the appliance.
List all running builds for the appliance with id id.
Result: Example
Arguments:
- build_id - Id of the build.
Show status of the build with id build_id.
Result: Example
Arguments:
- appliance_id - Id of the appliance.
- force (optional) - Force a build even if it overwrites an already existing build.
- version (optional) - The version of the appliance.
- image_type (optional) - The format of the build. Supported are 'xen','oem','vmx' and 'iso'.
Start a new build for the appliance with id id. If there already is a build with the same appliance settings (build type and version) an error is returned. In this case a build can be enforced by setting the optional force parameter to true. Optionally the appliance version and build type can be set with the version and image_type parameters.
Arguments:
- build_id - Id of the build.
Cancel build with id build_id.
Finished builds
Arguments:
- appliance_id - Id of the appliance.
List all completed builds for the appliance with id id.
Result: Example
Arguments:
- build_id - Id of the build.
Show build info of the build with id build_id.
Result: Example
Arguments:
- build_id - Id of the build.
Delete build with id build_id.
RPM Uploads
Arguments:
- base_system - Base system of the RPM or archive, e.g. 11.1 or SLED11.
List all uploaded RPMs for the base system base.
Result: Example
Arguments:
- rpm_id - ID of the uploaded RPM.
Show information on the uploaded RPM with id rpm_id.
Result: Example
Arguments:
- rpm_id - ID of the uploaded RPM.
Returns the RPM with id rpm_id.
Arguments:
- base_system - Base system of the RPM or archive, e.g. 11.1 or SLED11.
Adds an RPM or archive to the user repository for appliances base on base. The file is expected to be wrapped as with form-based file uploads in HTML (RFC 1867) in the body of the POST request.
Result: Example
Arguments:
- rpm_id - ID of the uploaded RPM.
Update the content of the RPM or archive with the id rpm_id. The file is expected to be wrapped as with form-based file uploads in HTML (RFC 1867) in the body of the POST request.
Result: Example
Arguments:
- rpm_id - ID of the uploaded RPM.
Deletes the RPM or archive with the id rpm_id from the user repository.
Repositories
Arguments:
- base_system (optional) - Limit the results to repositories with this base system.
- filter (optional) - Only show repositories matching this search string.
Returns a list of repositories. If neither base_system nor filter are specified all available repositories are returned. When filtering the results with the filter parameter, the repository name, repository url and repository packages are searched.
Result: Example
Arguments:
- url - Base url of the repository.
- name - Name for the repository.
Imports a new repository into Studio. Returns the metadata for the created repository.
Result: Example
Arguments:
- id - Id of the repository.
Show information on the repository with the id id.
Result: Example
