SUSE Studio User API
Version: v1.1
SUSE Studio offers a RESTful API which can be accessed entirely via HTTP.
The Studio API uses HTTP Basic authentication.
The credentials are the username and an API key as password, which the user can create and change at any time.
Table of Contents
- General 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
- GET /api/v1/user/appliances/<id>/repositories
- PUT /api/v1/user/appliances/<id>/repositories
- POST /api/v1/user/appliances/<id>/cmd/add_repository?repo_id=<repo_id>
- POST /api/v1/user/appliances/<id>/cmd/remove_repository?repo_id=<repo_id>
- POST /api/v1/user/appliances/<id>/cmd/add_user_repository
- 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>&url=<url>
- 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
- GET /api/v1/user/running_builds?appliance_id=<id>
- GET /api/v1/user/running_builds/<build_id>
- POST /api/v1/user/running_builds?appliance_id=<id>&force=<force>&version=<version>&image_type=<type>&multi=<multi>
- DELETE /api/v1/user/running_builds/<build_id>
- Finished builds
- GET /api/v1/user/builds?appliance_id=<id>
- GET /api/v1/user/builds/<build_id>
- DELETE /api/v1/user/builds/<build_id>
- RPM Uploads
- GET /api/v1/user/rpms?base_system=<base>
- GET /api/v1/user/rpms/<rpm_id>
- GET /api/v1/user/rpms/<rpm_id>/data
- POST /api/v1/user/rpms?base_system=<base>
- PUT /api/v1/user/rpms/<rpm_id>
- DELETE /api/v1/user/rpms/<rpm_id>
- Repositories
- GET /api/v1/user/repositories?base_system=<base>&filter=<search_string>
- POST /api/v1/user/repositories?url=<url>&name=<name>
- GET /api/v1/user/repositories/<id>
- Testdrives
General 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
Returns the running API version including the minor version.
Result: Example
Template sets
GET /api/v1/user/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
GET /api/v1/user/template_sets/<name>
Arguments:
- name - Name of template
Show template set name.
Result: Example
Appliances
GET /api/v1/user/appliances/<id>
Arguments:
- id - Id of the appliance
Show details of appliance with id id.
Result: Example
GET /api/v1/user/appliances/<id>/status
Arguments:
- id - Id of the appliance
Show information on the status of the appliance with id id.
Result: Example
POST /api/v1/user/appliances?clone_from=<appliance_id>&name=<name>&arch=<arch>
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.
DELETE /api/v1/user/appliances/<id>
Arguments:
- id - Id of the appliance
Delete appliance with id id.
Repositories
GET /api/v1/user/appliances/<id>/repositories
Arguments:
- id - Id of the appliance
List all repositories of the appliance with id id.
Result: Example
PUT /api/v1/user/appliances/<id>/repositories
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
POST /api/v1/user/appliances/<id>/cmd/add_repository?repo_id=<repo_id>
Arguments:
- id - Id of the appliance
- repo_id - Id of the repository.
Add the specified repository to the appliance with id id.
Result: Example
POST /api/v1/user/appliances/<id>/cmd/remove_repository?repo_id=<repo_id>
Arguments:
- id - Id of the appliance
- repo_id - Id of the repository.
Remove the specified repository from the appliance with id id.
Result: Example
POST /api/v1/user/appliances/<id>/cmd/add_user_repository
Arguments:
- id - Id of the appliance
Adds the according user repository (the one containing the uploaded RPMs) to the appliance.
Software Selection
GET /api/v1/user/appliances/<id>/software
Arguments:
- id - Id of the appliance
List all selected packages and patterns of the appliance with id id.
Result: Example
PUT /api/v1/user/appliances/<id>/software
Arguments:
- id - Id of the appliance
Update the list of selected packages and patterns of the appliance with id id.
Result: Example
GET /api/v1/user/appliances/<id>/software/installed?build_id=<build>
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
POST /api/v1/user/appliances/<id>/cmd/remove_package?name=<name>
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
POST /api/v1/user/appliances/<id>/cmd/remove_pattern?name=<name>
Arguments:
- id - Id of the appliance
- name - Name of the pattern.
Remove the specified pattern from the appliance with id id.
Result: Example
POST /api/v1/user/appliances/<id>/cmd/ban_package?name=<name>
Arguments:
- id - Id of the appliance
- name - Name of the package.
Ban a package from the appliance with id id.
Result: Example
POST /api/v1/user/appliances/<id>/cmd/unban_package?name=<name>
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
GET /api/v1/user/appliances/<id>/image_files?build_id=<build_id>&path=<path_to_file>
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.
GET /api/v1/user/appliances/<id>/gpg_keys
Arguments:
- id - Id of the appliance.
Lists all GPG keys of the appliance with the id id.
Result: Example
GET /api/v1/user/appliances/<id>/gpg_keys/<key_id>
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
POST /api/v1/user/appliances/<id>/gpg_keys?name=<name>&target=<target>&key=<the_key>
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
DELETE /api/v1/user/appliances/<id>/gpg_keys/<key_id>
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
GET /api/v1/user/files?appliance_id=<id>
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.
- url (optional) - The url of the file to add from the internet (HTTP and FTP are supported) when using the web upload method
Adds a file to the appliance with id id.
Files can either be uploaded in the body of the POST request or from a URL in the web:
- With direct uploads the file is expected to be wrapped as with form-based file uploads in HTML (RFC 1867) in the body
of the POST request as the file parameter. - For Uploads from the web you have to provide the url parameter.
can also be change later (see below).
Result: Example
GET /api/v1/user/files/<file_id>/data
Arguments:
- file_id - Id of the file.
Returns the file with id file_id.
PUT /api/v1/user/files/<file_id>/data
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
as the file parameter.
Result: Example
GET /api/v1/user/files/<file_id>
Arguments:
- file_id - Id of the file.
Returns the meta data of the file with id file_id.
Result: Example
PUT /api/v1/user/files/<file_id>
Arguments:
- file_id - Id of the file.
Writes the meta data of the file with id file_id.
Result: Example
DELETE /api/v1/user/files/<file_id>
Arguments:
- file_id - Id of the file.
Delete the file with id file_id and its meta data.
Running builds
GET /api/v1/user/running_builds?appliance_id=<id>
Arguments:
- appliance_id - Id of the appliance.
List all running builds for the appliance with id id.
Result: Example
GET /api/v1/user/running_builds/<build_id>
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'.
- multi (optional) - If set to true it enables multibuild mode, which allows to build different formats of one version.
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.
It is possible to build different formats of one appliance version. Therefor do a first build and when it's done trigger
the other formats with the multi parameter set to true.
DELETE /api/v1/user/running_builds/<build_id>
Arguments:
- build_id - Id of the build.
Cancel build with id build_id.
Finished builds
GET /api/v1/user/builds?appliance_id=<id>
Arguments:
- appliance_id - Id of the appliance.
List all completed builds for the appliance with id id.
Result: Example
GET /api/v1/user/builds/<build_id>
Arguments:
- build_id - Id of the build.
Show build info of the build with id build_id.
Result: Example
DELETE /api/v1/user/builds/<build_id>
Arguments:
- build_id - Id of the build.
Delete build with id build_id.
RPM Uploads
GET /api/v1/user/rpms?base_system=<base>
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
GET /api/v1/user/rpms/<rpm_id>
Arguments:
- rpm_id - ID of the uploaded RPM.
Show information on the uploaded RPM with id rpm_id.
Result: Example
GET /api/v1/user/rpms/<rpm_id>/data
Arguments:
- rpm_id - ID of the uploaded RPM.
Returns the RPM with id rpm_id.
POST /api/v1/user/rpms?base_system=<base>
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
as the file parameter.
Result: Example
PUT /api/v1/user/rpms/<rpm_id>
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
as the file parameter.
Result: Example
DELETE /api/v1/user/rpms/<rpm_id>
Arguments:
- rpm_id - ID of the uploaded RPM.
Deletes the RPM or archive with the id rpm_id from the user repository.
Repositories
GET /api/v1/user/repositories?base_system=<base>&filter=<search_string>
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
POST /api/v1/user/repositories?url=<url>&name=<name>
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
GET /api/v1/user/repositories/<id>
Arguments:
- id - Id of the repository.
Show information on the repository with the id id.
Result: Example
Testdrives
POST /api/v1/user/testdrives?build_id=<build_id>
Arguments:
- build_id - Id of the build to run in testdrive.
Starts a new testdrive session of the given build on the server and returns information about how to access it.
Note: Testdrive sessions will be aborted when no client has connected after 60 seconds.
Result: Example
Changelog
- Added the api_version method
- Added the /testdrives resource
- Extended the /files resource to also support file uploads from the web
- Extended the /running_builds resource to also allow building different formats of one version
- /appliances/<id>/image_files
- /appliances/<id>/gpg_keys
- /appliances/<id>/cmd/ban_package
- /appliances/<id>/cmd/unban_package
- /user/account
- /appliances/<id>/status
- /appliances/<id>/repositories
- /appliances/<id>/software
- /appliances/<id>/cmd
- /repositories
