0% found this document useful (0 votes)
316 views

OpenShift Online 2.0 REST API Guide en US

Reference documentation for OpenShift Online Representational State Transfer Application Programming Interface (REST API). Copyright © 2013 Red Hat. This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed. https://www.openshift.com/documentation

Uploaded by

rch978
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
316 views

OpenShift Online 2.0 REST API Guide en US

Reference documentation for OpenShift Online Representational State Transfer Application Programming Interface (REST API). Copyright © 2013 Red Hat. This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed. https://www.openshift.com/documentation

Uploaded by

rch978
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 160

OpenShift Online All Versions REST API Guide

Reference documentation for OpenShift Online Representational State Transfer Application Programming Interface (REST API) Edition 1.0

Red Hat OpenShift Documentation Team

OpenShift Online All Versions REST API Guide

Reference documentation for OpenShift Online Representational State Transfer Application Programming Interface (REST API) Edition 1.0

Red Hat OpenShift Do cumentatio n Team

Legal Notice Copyright 2013 Red Hat. T his document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, OpenShift, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux is the registered trademark of Linus T orvalds in the United States and other countries. Java is a registered trademark of Oracle and/or its affiliates. XFS is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project. All other trademarks are the property of their respective owners. Abstract T his document describes how to use the Representational State T ransfer (REST ) API for OpenShift Online.

Table of Contents

Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5. . . . . . . . . . 1. Document Conventions 5 1.1. T ypographic Conventions 5 1.2. Pull-quote Conventions 6 1.3. Notes and Warnings 7 2. Getting Help 7 2.1. Do You Need Help? 7 2.2. We Need Feedback! 8 Chapter . . . . . . . . . 1. . . .Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9. . . . . . . . . . 1.1. About OpenShift API 9 1.2. About Representational State T ransfer (REST ) 9 Chapter . . . . . . . . . 2. . . .General . . . . . . . . .API . . . .Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 ............ 2.1. Authentication 10 2.2. Version 10 2.3. Resource Links 12 2.4. Response Information 17 2.5. Messages 17 2.6. Response T ype 18 2.7. Status Codes 18 . . . . . . . . . 3. Chapter . . .API . . . .Entry . . . . . .Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 ............ Chapter . ........4 . ...User . . . . . Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 ............ 4.1. View User Information 26 4.2. Parent and Child Accounts 29 4.2.1. Delete Child Account 29 Chapter . . . . . . . . . 5. . . .Subscription . . . . . . . . . . . . . Plans .................................................................. 31 ........... 5.1. List Plans 31 5.2. Get Plan Information 34 5.3. Change Plan 37 Chapter . . . . . . . . . 6. . . .SSH . . . . .Keys .......................................................................... 39 ........... 6.1. Add SSH Key 39 6.2. List User SSH Keys 40 6.3. Get SSH Key Information 41 6.4. Update SSH Key 42 6.5. Delete SSH Key 44 Chapter . . . . . . . . . 7. . . .Authorizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 . .6. . . . . . . . . . 7.1. Add an Authorization 46 7.2. List Authorizations 48 7.3. Get Authorization Information 49 7.4. Update an Authorization 50 7.5. Delete an Authorization 51 Chapter . . . . . . . . . 8. . . .Domains ............................................................................... 53 ........... 8.1. Create a Domain 53 8.2. List Domains 54 8.3. List Domains by Owner 55 8.4. Get Domain Information 57 8.5. Update Domain 58

OpenShift Online All Versions REST API Guide

8.5. Update Domain 8.6. Delete a Domain

58 60

Chapter . . . . . . . . . 9. . . .Members ............................................................................... 63 ........... 9.1. List Members of a Domain 63 9.2. Add or Remove Domain Members 64 9.3. List Members of an Application 65 Chapter . . . . . . . . . 10. . . . . Quickstarts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 ............ 10.1. List Quickstarts 67 10.2. Show Quickstart 68 10.3. Search Quickstarts 69 Chapter . . . . . . . . . 11. . . . . Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 ............ 11.1. Resolve DNS 71 11.2. Create an Application 72 11.3. List Applications for a User 76 11.4. List Applications for a Domain 78 11.5. List Applications and Cartridges 80 11.6. Get Application Information 82 11.7. Get Application and Cartridge Information 84 11.8. Make an Application Highly Available (HA) 88 11.9. Start Application 89 11.10. Stop Application 91 11.11. Force Stop Application 93 11.12. Restart Application 95 11.13. Scale Up Application 97 11.14. Scale Down Application 99 11.15. T idy Application Framework 101 11.16. Reload Application 103 11.17. T rigger T hread Dump 105 11.18. Delete Application 107 Chapter . . . . . . . . . 12. . . . . Application . . . . . . . . . . . . Aliases . . . . . . . . and . . . . .SSL . . . . Certificates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 ............. 12.1. Add Application Alias 108 12.2. List Application Aliases 111 12.3. Get Application Alias Information 112 12.4. Update Application Alias 113 12.5. Delete Application Alias 116 Chapter . . . . . . . . . 13. . . . .Cartridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 ............. 13.1. List Cartridges 119 13.2. Embedded Cartridges 121 13.2.1. Add Embedded Cartridge 121 13.2.2. List Embedded Cartridges 124 13.2.3. Get Cartridge Information 126 13.2.4. Update Cartridge Configuration 128 13.2.5. Get Cartridge Status 131 13.2.6. Start Cartridge 132 13.2.7. Stop Cartridge 134 13.2.8. Restart Cartridge 136 13.2.9. Reload Cartridge 138 13.2.10. Delete Cartridge 140 Chapter . . . . . . . . . 14 . . . .. Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 . . .1. . . . . . . . . . 14.1. List Application Deployments 141 14.2. Deploy an Application 142 14.3. Activate a Deployment of an Application 144

Table of Contents

Chapter . . . . . . . . . 15. . . . . Environment . . . . . . . . . . . . . .Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 . . .7. . . . . . . . . . 15.1. Add Environment Variable 147 15.2. List Environment Variables 148 15.3. Get Environment Variable Information 149 15.4. Update Environment Variable 150 15.5. Delete Environment Variable 151 Chapter . . . . . . . . . 16. . . . . Gear . . . . . .Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 ............. 16.1. Get Application Gear Groups 153 Supported . . . . . . . . . . . .SSH . . . . .Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 ............. A.1. T ypes of SSH Keys Supported 156 . . . . . . . . . .History Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 .............

OpenShift Online All Versions REST API Guide

Preface

Preface
1. Document Conventions
T his manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. T he Liberation Fonts set is also used in HT ML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later include the Liberation Fonts set by default.

1.1. Typographic Conventions


Four typographic conventions are used to call attention to specific words and phrases. T hese conventions, and the circumstances they apply to, are as follows. Mono-spaced Bold Used to highlight system input, including shell commands, file names and paths. Also used to highlight keys and key combinations. For example: T o see the contents of the file m y_next_bestselling_novel in your current working directory, enter the cat m y_next_bestselling_novel command at the shell prompt and press Enter to execute the command. T he above includes a file name, a shell command and a key, all presented in mono-spaced bold and all distinguishable thanks to context. Key combinations can be distinguished from an individual key by the plus sign that connects each part of a key combination. For example: Press Enter to execute the command. Press Ctrl + Alt+ F2 to switch to a virtual terminal. T he first example highlights a particular key to press. T he second example highlights a key combination: a set of three keys pressed simultaneously. If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in m ono-spaced bold . For example: File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions. Proportional Bold T his denotes words or phrases encountered on a system, including application names; dialog-box text; labeled buttons; check-box and radio-button labels; menu titles and submenu titles. For example: Choose System Preferences Mouse from the main menu bar to launch Mouse Preferences. In the Buttons tab, select the Left-handed m ouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand). T o insert a special character into a gedit file, choose Applications Accessories

OpenShift Online All Versions REST API Guide

Character Map from the main menu bar. Next, choose Search Find from the Character Map menu bar, type the name of the character in the Search field and click Next. T he character you sought will be highlighted in the Character T able . Double-click this highlighted character to place it in the T ext to copy field and then click the Copy button. Now switch back to your document and choose Edit Paste from the gedit menu bar. T he above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context. Mono-spaced Bold Italic or Proportional Bold Italic Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example: T o connect to a remote machine using ssh, type ssh username@ domain.name at a shell prompt. If the remote machine is exam ple.com and your username on that machine is john, type ssh john@ exam ple.com . T he m ount -o rem ount file-system command remounts the named file system. For example, to remount the /hom e file system, the command is m ount -o rem ount /hom e . T o see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release. Note the words in bold italics above: username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system. Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example: Publican is a DocBook publishing system.

1.2. Pull-quote Conventions


T erminal output and source code listings are set off visually from the surrounding text. Output sent to a terminal is set in m ono-spaced rom an and presented thus:
books books_tests Desktop Desktop1 documentation downloads drafts images mss notes photos scripts stuff svgs svn

Source-code listings are also set in m ono-spaced rom an but add syntax highlighting as follows:

Preface

package org.jboss.book.jca.ex1; import javax.naming.InitialContext; public class ExClient { public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create(); System.out.println("Created Echo"); System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); } }

1.3. Notes and Warnings


Finally, we use three visual styles to draw attention to information that might otherwise be overlooked.

Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.

Important
Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled Important will not cause data loss but may cause irritation and frustration.

Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.

2. Getting Help
2.1. Do You Need Help?
If you experience difficulty with a procedure or other information described in this documentation, visit the Red Hat Customer Portal at http://access.redhat.com where you can: search or browse through a knowledgebase of technical support articles about Red Hat products submit a support case to Red Hat Global Support Services (GSS) access other product documentation

OpenShift Online All Versions REST API Guide

You can also access the OpenShift web site at https://openshift.redhat.com/ to find blogs, FAQs, forums, and other sources of information. Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click the name of any mailing list to subscribe to that list or to access the list archives.

2.2. We Need Feedback!


If you find a typographical or any other error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: http://bugzilla.redhat.com/ against the product Openshift Online. When submitting a bug report, be sure to mention the manual's identifier: Docs REST API Guide If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.

Chapter 1. Introduction

Chapter 1. Introduction
1.1. About OpenShift API
OpenShift provides a Representational State T ransfer (REST ) Application Programming Interface (API). Applications created for OpenShift can access the API using the standard Hypertext T ransfer Protocol (HT T P). T he OpenShift API is structured as a resource, and provides links to all children and any related resources.

Note
T he legacy API has been removed, and is no longer supported. All customers are advised to use the current OpenShift REST API. Report a bug

1.2. About Representational State Transfer (REST)


Representational State T ransfer (REST ) is a design architecture for networked applications or systems. In the REST design architecture a client progresses through an application by selecting links, also known as state transitions. Each link selected by the client returns a representation of the selected resource. Also, with each resource representation the client application transfers state, and results in a usable web page being transferred and rendered. In the REST design architecture, a resource is created for every service that an application provides, with each resource identified by a URL. A client can reference the resource using the URL. T he returned representation of the resource is further linked to more information, allowing the client to drill down as far as necessary to get more detailed information. T he client can access and perform operations on available resources with standard HT T P methods, such as GET , POST , PUT , and DELET E . Report a bug

OpenShift Online All Versions REST API Guide

Chapter 2. General API Information


2.1. Authentication
T he OpenShift API uses Basic Authentication. A client is required to send the username and password, separated by a colon, with all requests to correctly authenticate. For example, send the credentials as username:password. T his string is encoded with Base64 algorithm and transmitted in the HT T P authorization header in the formats shown below. Using Ruby
require 'base64' base64string = Base64.encode64("#{username}:#{password}").strip headers = { "Authorization" => "Basic #{base64string}" }

Using Python
import base64 base64string = base64.encodestring('%s:%s' % (username, password))[:-1] request.add_header("Authorization", "Basic %s" % base64string)

Using cURL T he cURL library supports basic authentication using the --user option, as shown in the example below.

$ curl -k https://openshift.redhat.com/broker/rest/user --user [email protected]

Report a bug

2.2. Version
Every OpenShift REST API call returns the current API version, and other versions that are supported. T he example below shows how to use the cURL command to return the API version.
$ curl -k "https://openshift.redhat.com/broker/rest/api"

T he response for this command is shown below in both XML and JSON syntax. XML Response

10

Chapter 2. General API Information

<response> <status>ok</status> <version>1.6</version> <supported-api-versions> <supported-api-version>1.0</supported-api-version> <supported-api-version>1.1</supported-api-version> <supported-api-version>1.2</supported-api-version> <supported-api-version>1.3</supported-api-version> <supported-api-version>1.4</supported-api-version> <supported-api-version>1.5</supported-api-version> <supported-api-version>1.6</supported-api-version> </supported-api-versions> </response>

JSON Response
{ "supported_api_versions": [ 1.0, 1.1, 1.2, 1.3, 1.4 1.5 1.6 ], "version": "1.6" }

T o request a specific API version, the client must include the HT T P header with the response request. Examples in both XML and JSON syntax are provided below. XML Clients
Accept: application/xml; version=1.5

JSON Clients
Accept: application/json; version=1.5

If the version requested by the client is not supported, the server responds with the HT T P status code 406, as shown in the examples below in XML and JSON syntax. XML Response for Unsupported Version

11

OpenShift Online All Versions REST API Guide

<response> <messages> <message> <text>Requested API version 2.0 is not supported. 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6</text> <severity>error</severity> </message> </messages> <version>1.6</version> <supported-api-versions> <supported-api-version>1.0</supported-api-version> <supported-api-version>1.1</supported-api-version> <supported-api-version>1.2</supported-api-version> <supported-api-version>1.3</supported-api-version> <supported-api-version>1.4</supported-api-version> <supported-api-version>1.5</supported-api-version> <supported-api-version>1.6</supported-api-version> </supported-api-versions> <status>not_acceptable</status> </response>

Supported versions are

JSON Response for Unsupported Version


{ "data": null, "messages": [ { "exit_code": null, "field": null, "severity": "error", "text": "Requested API version 2.0 is not supported. Supported versions are 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6" } ], "status": "not_acceptable", "supported_api_versions": [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 ], "type": null, "version": "1.6" }

Report a bug

2.3. Resource Links


T he OpenShift REST API implements the Hypermedia as the Engine of Application State, or HATEOAS, design principle of the REST application architecture. T his principle implies that the interaction between a client and a network application happens entirely through links provided dynamically by the application server. No prior knowledge, beyond a generic understanding of REST and HT T P protocol, is required from the REST client on how to interact with any particular application or server. Entry to the REST

12

Chapter 2. General API Information

application by a REST client is through a simple fixed URL. All future actions the client takes are discovered within resource representations returned from the server. T he client selects the links within these resources to navigate to the required resource. T he table below describes the elements contained in each resource link. T able 2.1. Resource Elements Element Name href m ethod required param eters optional param eters Description URL for resource link HT T P method to use with resource link: GET , PUT , POST , or DELET E An array of input parameters required from the client An array of optional input parameters

T he table below describes attributes associated with each required input parameter. T able 2.2. Required Parameter Attributes Name nam e type description valid options invalid options Description Name of parameter T ype of parameter, for example String, Integer, Array, or Boolean Brief description of the parameter An array of valid options, may be empty An array of invalid options, may be empty

T he table below describes attributes associated with each optional parameter. T able 2.3. Optional Parameter Attributes Name nam e type description valid options default value Description Name of parameter T ype of parameter, for example String, Integer, Array, or Boolean Brief description of the parameter An array of valid options, may be empty Default value for the optional parameter if not provided by the client

An example of an API representation in both XML and JSON syntax is shown below. XML Representation

13

OpenShift Online All Versions REST API Guide

<link> <optional-params/> <required-params> <param> <type>string</type> <valid-options/> <name>id</name> <description>Name of the domain</description> </param> </required-params> <href>https://openshift.redhat.com/broker/rest/domains</href> <rel>Create new domain</rel> <method>POST</method> </link>

JSON Representation
{ "required_params": [ { "type": "string", "valid_options": [], "description": "Name of the domain", "name": "id" } ], "method": "POST", "optional_params": [], "href": "https://openshift.redhat.com/broker/rest/domains", "rel": "Create new domain" }

Resource links from API responses can be hidden with the nolinks parameter. T he nolinks parameter can be included with all supported APIs and can be set to true or false. If the nolinks parameter is not included, it automatically defaults to false. If the nolinks parameter is included and set to true, the resource links are excluded from the API response resulting in a concise output and improved general processing speed. T he cURL command example below shows the API response for a GET method without the nolinks parameter:

14

Chapter 2. General API Information

$ curl -k -X GET https://openshift.redhat.com/broker/rest/user --user [email protected] { "api_version": 1.6, "data": { "capabilities": { "subaccounts": true, "gear_sizes": [ "small", "medium" ], "plan_upgrade_enabled": true, "private_ssl_certificates": true, "inherit_on_subaccounts": [ "gear_sizes" ] }, "consumed_gears": 2, "created_at": "2013-08-14T19:12:59Z", "id": "520bd6bbdbd93c3dee00000d", "links": { "ADD_KEY": { "href": "https://openshift.redhat.com/broker/rest/user/keys", "method": "POST", "optional_params": [], "rel": "Add new SSH key", "required_params": [ { "description": "Name of the key", "invalid_options": [], "name": "name", "type": "string", "valid_options": [] }, { "description": "Type of Key", "invalid_options": [], "name": "type", "type": "string", "valid_options": [ "ssh-rsa", "ssh-dss", "[email protected]", "[email protected]", "[email protected]", "[email protected]" ] }, { "description": "The key portion of an rsa key (excluding ssh-rsa and comment)", "invalid_options": [], "name": "content", "type": "string", "valid_options": [] } ] }, "LIST_KEYS": { "href": "https://openshift.redhat.com/broker/rest/user/keys",

15

OpenShift Online All Versions REST API Guide

"method": "GET", "optional_params": [], "rel": "List SSH keys", "required_params": [] } }, "login": "[email protected]", "max_gears": 10, "plan_id": "free", "plan_state": "ACTIVE", "usage_account_id": null }, "messages": [], "status": "ok", "type": "user", "version": "1.6" }

T he cURL command example below shows the API response for a GET method with the nolinks parameter set to true:
$ curl -k -X GET https://openshift.redhat.com/broker/rest/user?nolinks=true -user " [UserName]:[Password]" { "data": { "capabilities": { "gear_sizes": [ "small", "medium" ], "plan_upgrade_enabled": true, "private_ssl_certificates": true, "subaccounts": false, "max_storage_per_gear": 5 }, "consumed_gears": 5, "created_at": "2013-02-07T22:48:58Z", "id": "51142f5adbd93ce16a0005b3", "login": "[email protected]", "max_gears": 16, "plan_id": "silver", "plan_state": "ACTIVE", "usage_account_id": "2526383" }, "messages": [], "status": "ok", "type": "user", }

T he cURL command example below shows the API response for a PUT method with the nolinks parameter set to true:

16

Chapter 2. General API Information

$ curl -k -X PUT https://openshift.redhat.com/broker/rest/user --user " [UserName]:[Password]" --data "plan_id=free" --data "nolinks=true" { "data": { "capabilities": { "plan_upgrade_enabled": true, "subaccounts": false, "gear_sizes": [ "small" ] }, "consumed_gears": 0, "created_at": "2013-05-29T23:18:16Z", "id": "51a68cb836905d42c3000016", "login": "user", "max_gears": 3, "plan_id": "free", "plan_state": "ACTIVE", "usage_account_id": "2223379" }, "errors": {}, "messages": [], "status": "ok", "type": "account", }

Report a bug

2.4. Response Information


T he table below describes information contained in each API response. T able 2.4 . API Response Parameters Name status data type m essages API version Description HT T P status text. Examples include ok or not_found T he data requested from the API. T his can be null in cases where there is no data to return T ype of data. For example, application or cartridge. T his can be null in cases where there is no data to return An array of messages returned to the client. See Section 2.5, Messages for more information on API messages API version requested by the client and returned by the API. Defaults to latest if the version is not specified. See Section 2.2, Version for more information An array of supported API versions

supported API versions

Report a bug

2.5. Messages
T he table below describes the parameters contained in each message from the API response. T he API can return zero or more messages.

17

OpenShift Online All Versions REST API Guide

T able 2.5. API Message Parameters Name severity text field exit code Description Message severity. Examples include debug, info, warning, error, and result T ext of the message Indicates the message is relevant to a particular field in the resource. Used for validation errors and can be null Exit code returned by the API. 0 if there are no issues

Note
Messages that return severity=result contain information that is passed to the user. Examples include database usernames and passwords. Report a bug

2.6. Response Type


Although OpenShift supports both XML and JSON response formats, the default server response is the JSON syntax. Include the following HT T P header to receive the response in XML:
Accept: application/xml

Using Ruby
headers = {"Accept" => "application/xml"}

Using Python
request.add_header("Accept", "application/xml")

Using cURL
curl -k "https://openshift.redhat.com/broker/rest/api" -H "Accept: application/xml"

Report a bug

2.7. Status Codes


T he OpenShift REST API attempts to return standard HTTP status codes. T he more common status codes are shown in the table below along with a brief description of each.

18

Chapter 2. General API Information

T able 2.6. HT T P Status Codes Code 200 201 204 301 400 401 403 404 406 T ext OK Created No content Moved Permanently Bad Request Unauthorized Forbidden Not Found Not Acceptable Description Standard response for successful HT T P requests. T he resource was successfully created. T he requested delete operation was successful. T he resource has moved, and all future requests should be made to the new URI. Invalid request due to bad syntax. Authentication has failed, or was not provided. T he request is understood, but server is refusing to respond. T he requested resource cannot be found. T he content from the requested resource is not acceptable according to the Accept headers. Possibly due to version requested, or it no longer being supported. T he request could not be processed because of conflict in the request. T he resource is no longer available, and will not be available again. T he request was well formed, but was not followed due to semantic errors. A generic error message when something is broken. Server was acting as a gateway or proxy, and received an invalid response. T he server is currently unavailable; possibly down for maintenance. T he server was acting as a gateway or proxy and did not receive a timely response.

409 410 422 500 502 503 504

Conflict Gone Unprocessable Entity Internal Server Error Bad Gateway Service Unavailable Gateway T imeout

Report a bug

19

OpenShift Online All Versions REST API Guide

Chapter 3. API Entry Point


Description Interaction with the OpenShift API begins with a request to the URL for the API entry point. T he entry point provides navigation links to resources for a client to manage an OpenShift cloud environment. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/api

URL Structure /broker/rest/api

JSON Response T he OpenShift API resources are returned. Unnecessary information has been left out for brevity.

20

Chapter 3. API Entry Point

{ "api_version": 1.6, "data": { "API": { "href": "https://openshift.redhat.com/broker/rest/api", "method": "GET", "optional_params": [], "rel": "API entry point", "required_params": [] }, "GET_ENVIRONMENT": { "href": "https://openshift.redhat.com/broker/rest/environment", "method": "GET", "optional_params": [], "rel": "Get environment information", "required_params": [] }, "GET_USER": { "href": "https://openshift.redhat.com/broker/rest/user", "method": "GET", "optional_params": [], "rel": "Get user information", "required_params": [] }, "ADD_DOMAIN": { "href": "https://openshift.redhat.com/broker/rest/domains", "method": "POST", "optional_params": [], "rel": "Create new domain", "required_params": [ { "description": "Name of the domain", "invalid_options": [ "amentra", "aop", ........ "wise", "xnio" ], "name": "name", "type": "string", "valid_options": [] } ] }, "LIST_DOMAINS": { "href": "https://openshift.redhat.com/broker/rest/domains", "method": "GET", "optional_params": [], "rel": "List all domains you have access to", "required_params": [] }, "LIST_DOMAINS_BY_OWNER": { "href": "https://openshift.redhat.com/broker/rest/domains", "method": "GET", "optional_params": [], "rel": "List domains", "required_params": [ { "description": "Return only the domains owned by the

21

OpenShift Online All Versions REST API Guide

specified user id or identity. Use @self to refer to the current user.", "invalid_options": [], "name": "owner", "type": "string", "valid_options": [ "@self", "*" ] } ] }, "SHOW_DOMAIN": { "href": "https://openshift.redhat.com/broker/rest/domain/:name", "method": "GET", "optional_params": [], "rel": "Retrieve a domain by its name", "required_params": [ { "description": "Unique name of the domain", "invalid_options": [], "name": ":name", "type": "string", "valid_options": [] } ] }, "SHOW_APPLICATION_BY_DOMAIN": { "href": "https://openshift.redhat.com/broker/rest/domain/:domain_name/application/:name", "method": "GET", "optional_params": [], "rel": "Retrieve an application by its name and domain", "required_params": [ { "description": "Unique name of the domain", "invalid_options": [], "name": ":domain_name", "type": "string", "valid_options": [] }, { "description": "Name of the application", "invalid_options": [], "name": ":name", "type": "string", "valid_options": [] } ] }, "LIST_CARTRIDGES": { "href": "https://openshift.redhat.com/broker/rest/cartridges", "method": "GET", "optional_params": [], "rel": "List cartridges", "required_params": [] }, "LIST_APPLICATIONS": { "href": "https://openshift.redhat.com/broker/rest/applications", "method": "GET", "optional_params": [],

22

Chapter 3. API Entry Point

"rel": "List application", "required_params": [] }, "SHOW_APPLICATION": { "href": "https://openshift.redhat.com/broker/rest/application/:id", "method": "GET", "optional_params": [], "rel": "List application", "required_params": [ { "description": "Unique identifier of the application", "invalid_options": [], "name": ":id", "type": "string", "valid_options": [] } ] }, "LIST_AUTHORIZATIONS": { "href": "https://openshift.redhat.com/broker/rest/user/authorizations", "method": "GET", "optional_params": [], "rel": "List authorizations", "required_params": [] }, "SHOW_AUTHORIZATION": { "href": "https://openshift.redhat.com/broker/rest/user/authorization/:id", "method": "GET", "optional_params": [], "rel": "Retrieve authorization :id", "required_params": [ { "description": "Unique identifier of the authorization", "invalid_options": [], "name": ":id", "type": "string", "valid_options": [] } ] }, "ADD_AUTHORIZATION": { "href": "https://openshift.redhat.com/broker/rest/user/authorizations", "method": "POST", "optional_params": [ { "default_value": "userinfo", "description": "Select one or more scopes that this authorization will grant access to:\n\n* session\n Grants a client the authority to perform all API actions against your account. Valid for 1 day.\n* read\n Allows the client to access resources you own without making changes. Does not allow access to view authorization tokens. Valid for about 1 month.\n* userinfo\n Allows a client to view your login name, unique id, and your user capabilities. Valid for about 1 month.\n* domain/:id/view\n Grant read-only access to a single domain. Valid for about 1 month.\n* domain/:id/edit\n Grant edit access to a single domain and all its applications. Valid for about 1 month.\n* domain/:id/admin\n Grant full administrative access to a single domain and all its applications. Valid for about 1 month.\n* application/:id/view\n Grant read-only access to a single application. Valid for about 1 month.\n* application/:id/edit\n Grant edit access to a single application. Valid for about

23

OpenShift Online All Versions REST API Guide

1 month.\n* application/:id/admin\n Grant full administrative access to a single application. Valid for about 1 month.", "name": "scope", "type": "string", "valid_options": [ "session", "read", "userinfo", "domain/:id/view", "domain/:id/edit", "domain/:id/admin", "application/:id/view", "application/:id/edit", "application/:id/admin" ] }, { "default_value": null, "description": "A description to remind you what this authorization is for.", "name": "note", "type": "string", "valid_options": [] }, { "default_value": -1, "description": "The number of seconds before this authorization expires. Out of range values will be set to the maximum allowed time.", "name": "expires_in", "type": "integer", "valid_options": [] }, { "default_value": false, "description": "Attempt to locate and reuse an authorization that matches the scope and note and has not yet expired.", "name": "reuse", "type": "boolean", "valid_options": [ true, false ] } ], "rel": "Add new authorization", "required_params": [] }, "LIST_QUICKSTARTS": { "href": "https://www.openshift.com/api/v1/quickstarts/promoted.json", "method": "GET", "optional_params": [], "rel": "List quickstarts", "required_params": [] }, "SHOW_QUICKSTART": { "href": "https://www.openshift.com/api/v1/quickstarts/:id", "method": "GET", "optional_params": [], "rel": "Retrieve quickstart with :id",

24

Chapter 3. API Entry Point

"required_params": [ { "description": "Unique identifier of the quickstart", "invalid_options": [], "name": ":id", "type": "string", "valid_options": [] } ] }, "SEARCH_QUICKSTARTS": { "href": "https://www.openshift.com/api/v1/quickstarts.json", "method": "GET", "optional_params": [], "rel": "Search quickstarts", "required_params": [ { "description": "The search term to use for the quickstart", "invalid_options": [], "name": "search", "type": "string", "valid_options": [] } ] } }, "messages": [], "status": "ok", "type": "links", "version": "1.6" }

Report a bug

25

OpenShift Online All Versions REST API Guide

Chapter 4. User Information


T his chapter provides information on API resources that allow a client to manage OpenShift user account information. T he table below describes each parameter associated with a user account. Name capabilities consum ed_gears login m ax_gears plan_id plan_state Description Map of user capabilities. See the table below for user capabilities. T otal number of gears consumed by all applications owned by user. Account user name. Maximum number of gears available to the specified user. Subscription plan of the specified user. State of the account for the specified user.

T he table below further describes each available capability for the user. Name plan_upgrade_enabled subaccounts gear_sizes m ax_storage_per_gear private_ssl_certificat es Report a bug Description Indicates whether the user is on an upgraded plan. Indicates whether the user has the ability to create subaccounts. Available gear sizes depending on the type of plan. Maximum storage in gigabytes available per gear to the specified user. Subscription plan of the specified user.

4.1. View User Information


Description Provides resource links to view user information, and manage user SSH keys. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/user --user [email protected]:password

Resource URL /broker/rest/user

JSON Response T he API returns the user information resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 4, User Information for more information

26

Chapter 4. User Information

on all user information parameters.

27

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "capabilities": { "subaccounts": true, "gear_sizes": [ "small", "medium" ], "plan_upgrade_enabled": true, "private_ssl_certificates": true, "inherit_on_subaccounts": [ "gear_sizes" ] }, "consumed_gears": 2, "created_at": "2013-08-14T19:12:59Z", "id": "520bd6bbdbd93c3dee00000d", "links": { "ADD_KEY": { "href": "https://openshift.redhat.com/broker/rest/user/keys", "method": "POST", "optional_params": [], "rel": "Add new SSH key", "required_params": [ { "description": "Name of the key", "invalid_options": [], "name": "name", "type": "string", "valid_options": [] }, { "description": "Type of Key", "invalid_options": [], "name": "type", "type": "string", "valid_options": [ "ssh-rsa", "ssh-dss", "[email protected]", "[email protected]", "[email protected]", "[email protected]" ] }, { "description": "The key portion of an rsa key (excluding ssh-rsa and comment)", "invalid_options": [], "name": "content", "type": "string", "valid_options": [] } ] }, "LIST_KEYS": { "href": "https://openshift.redhat.com/broker/rest/user/keys", "method": "GET", "optional_params": [],

28

Chapter 4. User Information

"rel": "List SSH keys", "required_params": [] } }, "login": "[email protected]", "max_gears": 10, "plan_id": "free", "plan_state": "ACTIVE", "usage_account_id": null }, "messages": [], "status": "ok", "type": "user", "version": "1.6" }

Report a bug

4.2. Parent and Child Accounts


Parent accounts that have the subaccounts capability enabled can contain child user accounts. See Chapter 4, User Information for more information on all user account parameters and capabilities. Report a bug

4.2.1. Delete Child Account


Description Delete the specified child user account, if one exists.

Note
Parent accounts cannot be deleted. T herefore, the API returns an error message if you attempt to delete a parent account. Method and URL Structure Method DELET E Request Parameters Not applicable cURL Command Example
$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/user -d --user child_user:password

Resource URL /broker/rest/user

JSON Response No content is returned from a successful DELET E operation.

29

OpenShift Online All Versions REST API Guide

Report a bug

30

Chapter 5. Subscription Plans

Chapter 5. Subscription Plans


T his chapter provides information on API resources that allow a client to view and modify OpenShift subscription plans. T he table below describes each parameter associated with a subscription plan. Name id capabilities nam e plan_no usage_rates Description Plan identifier that can be used to get more information about that particular plan. Currently the free and silver plans are offered. Map of user capabilities. See the table below for plan capabilities. Plan name. Plan number associated with the plan name, and is the third party billing provider plan number. Plan usage costs.

T he table below further describes each available capability based on the subscription plan. Name subaccounts m ax_gears gear_sizes Description Indicates whether the user has the ability to create subaccounts. Maximum number of available gears for the subscribed plan. Available gear sizes depending on the type of plan.

m ax_untracked_addtl_storage_per_ Maximum additional filesystem storage per gear that will NOT be tracked for the user. gear m ax_tracked_addtl_storage_per_g ear plan_upgrade_enabled private_ssl_certificates Report a bug Maximum additional filesystem storage per gear that will be tracked for the user. Indicates whether the user is on an upgraded plan. Subscription plan of the specified user.

5.1. List Plans


Description Get a list of all supported subscription plans with details of each plan. Each plan is priced differently and provides certain capabilities that are assigned when you subscribe to a particular plan. Currently the free and silver plans are offered, with each offering different capabilities that determine what type of resources are available to you. Go to www.openshift.com for more information on available subscription plans. Method and URL Structure Method GET Request Parameters Not applicable Resource URL /broker/rest/plans

31

OpenShift Online All Versions REST API Guide

cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/plans

JSON Response T he API returns the plans resource with additional resource links. See Chapter 5, Subscription Plans for more information on all plan parameters.

32

Chapter 5. Subscription Plans

{ "api_version": 1.6, "data": [ { "capabilities": { "subaccounts": false, "max_gears": 3, "gear_sizes": [ "small" ], "plan_upgrade_enabled": true }, "id": "free", "links": { "GET_FREE_PLAN": { "href": "https://openshift.redhat.com/broker/rest/plans/free", "method": "GET", "optional_params": [], "rel": "Get free plan", "required_params": [] } }, "name": "Free", "plan_no": 10332742, "usage_rates": null }, { "capabilities": { "subaccounts": false, "max_gears": 16, "gear_sizes": [ "small", "medium" ], "max_untracked_addtl_storage_per_gear": 5, "max_tracked_addtl_storage_per_gear": 0, "plan_upgrade_enabled": true, "private_ssl_certificates": true }, "id": "silver", "links": { "GET_SILVER_PLAN": { "href": "https://openshift.redhat.com/broker/rest/plans/silver", "method": "GET", "optional_params": [], "rel": "Get silver plan", "required_params": [] } }, "name": "Silver", "plan_no": 10332743, "usage_rates": { "gear": { "small": { "usd": 0.04, "cad": 0.04, "eur": 0.03, "duration": "hour" },

33

OpenShift Online All Versions REST API Guide

"medium": { "usd": 0.1, "cad": 0.1, "eur": 0.08, "duration": "hour" } }, "storage": { "gigabyte": { "usd": 0, "cad": 0, "eur": 0, "duration": "month" } }, "cartridge": { "jbosseap-6": { "usd": 0.03, "cad": 0.03, "eur": 0.02, "duration": "hour" } } } } ], "messages": [], "status": "ok", "type": "plans", "version": "1.6" }

Report a bug

5.2. Get Plan Information


Description Get information about a specific plan with the plan identifier. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/plans/silver

Resource URL /broker/rest/plans/:id

JSON Response T he API returns detailed information about the specified plan, and shows resources and capabilities

34

Chapter 5. Subscription Plans

available to the user. See Chapter 5, Subscription Plans for more information on all plan parameters.

35

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "capabilities": { "subaccounts": false, "max_gears": 16, "gear_sizes": [ "small", "medium" ], "max_untracked_addtl_storage_per_gear": 5, "max_tracked_addtl_storage_per_gear": 0, "plan_upgrade_enabled": true, "private_ssl_certificates": true }, "id": "silver", "links": { "GET_SILVER_PLAN": { "href": "https://openshift.redhat.com/broker/rest/plans/silver", "method": "GET", "optional_params": [], "rel": "Get silver plan", "required_params": [] } }, "name": "Silver", "plan_no": 10332743, "usage_rates": { "gear": { "small": { "usd": 0.04, "cad": 0.04, "eur": 0.03, "duration": "hour" }, "medium": { "usd": 0.1, "cad": 0.1, "eur": 0.08, "duration": "hour" } }, "storage": { "gigabyte": { "usd": 0, "cad": 0, "eur": 0, "duration": "month" } }, "cartridge": { "jbosseap-6": { "usd": 0.03, "cad": 0.03, "eur": 0.02, "duration": "hour" } } } },

36

Chapter 5. Subscription Plans

"messages": [], "status": "ok", "type": "plan", "version": "1.6" }

Report a bug

5.3. Change Plan


Description Change to a different subscription plan. Regardless of the current plan, all capabilities of the new plan become available after you execute this REST API call.

Note
An upgraded OpenShift Online account is required to upgrade an account to the Silver plan with this REST API call. Go to www.openshift.com for more information on available subscription plans. Method and URL Structure Method PUT Request Parameters Name plan_id Description Plan identifier; for example, silver T ype String Require d Yes Valid Options free ; silver Default Value Not applicable Resource URL /broker/rest/user

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/user --user [email protected]:password --data "plan_id=silver"

JSON Response T he API returns the user information resource and related resource links. See Chapter 4, User Information for more information on all user information parameters.

37

OpenShift Online All Versions REST API Guide

{ "data": { "capabilities": { "plan_upgrade_enabled": true, "subaccounts": false, "gear_sizes": [ "small", "medium" ], "private_ssl_certificates": true, "max_storage_per_gear": 5 }, "consumed_gears": 1, "created_at": "2013-05-16T23:43:25Z", "id": "51956f1d686f90a138000001", "login": "[email protected]", "max_gears": 16, "plan_id": "silver", "plan_state": "ACTIVE", "usage_account_id": "2540629" }, "errors": {}, "messages": [], "status": "ok", "type": "account", }

Report a bug

38

Chapter 6. SSH Keys

Chapter 6. SSH Keys


T his chapter provides information on API resources that allow a client to view and manage SSH keys. T he table below describes each parameter associated with SSH keys. Name nam e content type Description Name of the SSH key as specific by the user. Content of the public SSH key. T ype of SSH key; for example, RSA or DSA. See Section A.1, T ypes of SSH Keys Supported.

Report a bug

6.1. Add SSH Key


Description Add an SSH key to the specified user account. Method and URL Structure Method POST Request Parameters Name nam e type Description Name of key T ype of SSH key T ype String String Required Yes Yes Valid Options Not applicable See Section A.1, T ypes of SSH Keys Supported Not applicable Default Value Not applicable Not applicable Resource URL /broker/rest/user/keys

content

T he key portion (excluding ssh-rsa and comment)

String

Yes

Not applicable

Request
{ "name": "mykey", "type": "ssh-rsa", "content": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6jPNu9ZbtW QcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb/lXUfLquMq+B MOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIudGdRdK+/PzV75TW1 LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtfedzCGZLe+6OxReuatw6M +n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3" }

cURL Command Example

39

OpenShift Online All Versions REST API Guide

$ curl -k -X POST https://openshift.redhat.com/broker/rest/user/keys --user [email protected]:password --data-urlencode name=mysshkey --data-urlencode type=ssh-rsa --data-urlencode content=AAAAB3NzaC1yc2EhyuiBIwAAAQEA14PDPWsaZMDspZNK7ABsppzwy++Ih2tRwjBkxzC2K EcQi7v8IcyODb7qLJ72tgx3G90zRm7vQ6wuyy7rkYLIvTYiDnchy68ikjyt7wuBuSCgFcHLUdon7xn 7VrskjhMN4pae6bjaY1+o4Knpfm3N72+9q/6+T52QIWCE1+Ku6UYYuOGy8qWynddw24bp4jGEKAXq TXcALuBoukC3uB+hrxvZYH1fbek6aEAQPYzO6sGqJqV1UoF0ascelhtyui8kadrKPr/5uJsPS+kGZ guU16ykQb2k9K03JMSfvPP4rLe50Q9G4dSZFbUOQXdC3n13CqvsEVzizUGl0HyT8MhRqw==

JSON Response T he API returns the key resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 6, SSH Keys for more information on all SSH key parameters.
{ "api_version": 1.6, "data": { "content": "AAAAB3NzaC1yc2EhyuiBIwAAAQEA14PDPWsaZMDspZNK7ABsppzwy++Ih2tRwjBkxzC2KEcQi7v8IcyOD b7qLJ72tgx3G90zRm7vQ6wuyy7rkYLIvTYiDnchy68ikjyt7wuBuSCgFcHLUdon7xn7VrskjhMN4pae6bja Y1+o4Knpfm3N72+9q/6+T52QIWCE1+Ku6UYYuOGy8qWynddw24bp4jGEKAXqTXcALuBoukC3uB+hrxvZYH 1fbek6aEAQPYzO6sGqJqV1UoF0ascelhtyui8kadrKPr/5uJsPS+kGZguU16ykQb2k9K03JMSfvPP4rLe5 0Q9G4dSZFbUOQXdC3n13CqvsEVzizUGl0HyT8MhRqw", "name": "mykey", "type": "ssh-rsa" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Created SSH key mykey" } ], "status": "created", "type": "key", "version": "1.6" }

Report a bug

6.2. List User SSH Keys


Description Get a list of SSH keys for an OpenShift user. Method and URL Structure Method GET Request Parameters Not applicable Resource URL /broker/rest/user/keys

40

Chapter 6. SSH Keys

cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/user/keys --user [email protected]:password

JSON Response T he API returns the key resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 6, SSH Keys for more information on all SSH key parameters.
{ "api_version": 1.6, "data": [ { "content": "AAAAB3NzaC1yc2gyiketIwAAAQEA3DyqVJYGQRvbyc9TZAumxU3C5v2cBF5YCJMRobDpXWAdG6Ls4pWp k/10CwiJDQcWa8Oeq3HajnAJfalz8rGXXHp9UA9YNp4vrzYDgLkCzS5jHJzMIu7aIJS6WrFB1i1nZwnIyf thyBmSX8C8bWK3+FeZYqwmXy++t4uoZIYJ5RTffW8/1w3sgt47juikR6qzzSDh1Bks+GW5i1FxQD7PeuIZ FJlAJyJLtiAPfbazX3YrroiPRL9YnB/QTpLg2jGeTtlC2UPhofbwMqAqaVpjCShHTZRW+aPGGB95BuwZMz OR2huioplkVRE7uhLsn3kFrsUBtu0SzPSSZ5fUQjeMUQ==", "name": "default", "type": "ssh-rsa" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found 1 ssh keys" } ], "status": "ok", "type": "keys", "version": "1.6" }

Report a bug

6.3. Get SSH Key Information


Description View the contents of an SSH key. Method and URL Structure Method GET Request Parameters Not applicable Resource URL /broker/rest/user/keys/:name

41

OpenShift Online All Versions REST API Guide

cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/user/keys/mysshkey -user [email protected]:password

JSON Response T he API returns the key resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 6, SSH Keys for more information on all SSH key parameters.
{ "api_version": 1.6, "data": { "content": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6jPNu9ZbtW QcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb/lXUfLquMq+B MOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIudGdRdK+/PzV75TW1 LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtfedzCGZLe+6OxReuatw6M +n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3", "name": "mysshkey", "type": "ssh-rsa" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found SSH key 'mysshkey'" } ], "status": "ok", "type": "key", "version": "1.6" }

Report a bug

6.4. Update SSH Key


Description Update the contents of an existing SSH key. Method and URL Structure Method PUT Request Parameters Name type Description T ype of key T ype String Required Yes Valid Options See Section A.1, T ypes of SSH Keys Supported Default Value Not applicable Resource URL /broker/rest/user/keys/:name

42

Chapter 6. SSH Keys

content

T he key portion of an rsa key (excluding ssh-rsa and comment)

String

Yes

Not applicable

Not applicable

Request
{ "type": "ssh-rsa", "content": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6jPNu9ZbtW QcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb/lXUfLquMq+B MOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIudGdRdK+/PzV75TW1 LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtfedzCGZLe+6OxReuatw6M +n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3" }

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/user/keys/mysshkey -user [email protected]:password --data-urlencode type=ssh-rsa --data-urlencode content=AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6 jPNu9ZbtWQcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb /lXUfLquMq+BMOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIu dGdRdK+/PzV75TW1LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtf edzCGZLe+6OxReuatw6M+n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3

Note
It is recommended to URL encode the key contents because it may contain non alphanumeric characters. JSON Response T he API returns the key resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 6, SSH Keys for more information on all SSH key parameters.

43

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "content": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6jPNu9ZbtW QcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb/lXUfLquMq+B MOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIudGdRdK+/PzV75TW1 LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtfedzCGZLe+6OxReuatw6M +n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3", "name": "mykey", "type": "ssh-rsa" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Updates SSH key mysshkey for [email protected]" } ], "status": "ok", "type": "key", "version": "1.6" }

Report a bug

6.5. Delete SSH Key


Description Delete an SSH key from a user account. Method and URL Structure Method DELET E Request Parameters Not applicable cURL Command Example
$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/user/keys/mysshkey --user [email protected]:password

Resource URL /broker/rest/user/keys/:name

JSON Response

44

Chapter 6. SSH Keys

{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Deleted SSH key mysshkey" } ], "status": "ok", "type": null, "version": "1.6" }

T he API returns an error message if the SSH key to be deleted is not found.
{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 118, "field": null, "severity": "error", "text": "User ssh key 'fakekey' not found." } ], "status": "not_found", "type": null, "version": "1.6" }

Report a bug

45

OpenShift Online All Versions REST API Guide

Chapter 7. Authorizations
T his chapter provides information on API resources to add, view, and manage authorization tokens. An authorization token is a secret value that allows access to an OpenShift account without having to supply login information each time. An authorization token can also be used to grant another user access to your account. Authorization tokens use scopes to determine the type of access a user is granted and what they can do with that token; for example full access versus limited access. Authorization tokens are easily managed, and offer better security because you are not repeatedly supplying your login credentials. For example, if your password is ever compromised, the password must be reset. If a secret authorization token is compromised, that token can be revoked and another one created. T he table below describes each parameter associated with an OpenShift authorization token. Name id scope Description Unique OpenShift login that created this authorization token. Scope of the authorization token to determine type of access. Scopes that are supported by a server are described in the ADD_AUT HORIZAT ION resource link and may be different for each server. A reminder description of what the authorization is for. T otal time in seconds before this authorization expires. Out of range values will be set to the maximum allowed time. Remaining time in seconds before this authorization expires. Attempt to locate and reuse an authorization that matches the scope and note and has not yet expired. Authorization string that contains user credentials.

note expires_in expires_in_second s reuse token

T he table below describes the available scope options that determine the type of access a user is granted with an authorization. Name session read userinfo Report a bug Description Grants a client the authority to perform all API actions against an account. Valid for one day. Access to the API is read-only, while authorization endpoints cannot be read. Only read access to the /user API resource is provided.

7.1. Add an Authorization


Description Add an authorization to the specified user account. Method and URL Structure Method POST Request Parameters URL Structure /broker/rest/user/authorizations

46

Chapter 7. Authorizations

Name scope

Description Scope of the authorization

T ype String

Required No

Valid Options session ; read ; userinfo ; dom ain/:id/vie w; dom ain/:id/edi t; dom ain/:id/adm in ; application/:i d/view; application/:i d/edit; application/:i d/adm in Not applicable

Default Value userinfo

note

Reminder description of authorization Number of seconds before authorization expires Attempt to locate and reuse an authorization matching scope and note and has not expired

String

No

Not applicable

expires_i n

String

No

Not applicable

-1. For invalid values, the default value is determined by the server false

reuse

Boolea n

No

true ; false

Request
{ "scope": "userinfo", "note": "This is my UPDATED note to myself", "expires_in": -1, "reuse": false }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/user/authorizations --user [email protected]:password --data-urlencode scope=userinfo --dataurlencode note=This is my UPDATED note to myself --data-urlencode expires_in=-1 --data-urlencode reuse=false

JSON Response T he related resource links returned by the API have been left out for brevity. See Chapter 7, Authorizations for more information on all authorization parameters.

47

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "created_at": "2013-08-21T02:02:10Z", "expires_in": 2592000, "expires_in_seconds": 2592000, "id": "52141fa2e499b2229e00009b", "identity": "[email protected]", "note": "This is my UPDATED note to myself", "scopes": "userinfo", "token": "6c85ff7f619a964e260ee6def3fc5829128dbba3f8bc11a5d89178e0d6e7a163" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Create authorization" } ], "status": "created", "type": "authorization", "version": "1.6" }

Report a bug

7.2. List Authorizations


Description List all authorizations for the specified user account, and provides the client additional resource links to manage existing authorizations. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/user/authorizations --user [email protected]:password"

URL Structure /broker/rest/user/authorizations

JSON Response T he API returns the authorizations resource with related resource links which have been left out for brevity. No resource links are returned if the user account does not contain any authorizations. See Chapter 7, Authorizations for more information on all authorization parameters.

48

Chapter 7. Authorizations

{ "api_version": 1.6, "data": [ { "created_at": "2013-08-22T02:30:47Z", "expires_in": 86400, "expires_in_seconds": 6870, "id": "521577d703ef64a3120000de", "identity": "[email protected]", "note": "OpenShift Console (from 66.187.239.10 on Firefox)", "scopes": "session", "token": "187bd89d1f5172af567eb12631c45gt7415dca5c2b7jy56970b3f3a911df4697" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "List authorizations" } ], "status": "ok", "type": "authorizations", "version": "1.6" }

Report a bug

7.3. Get Authorization Information


Description Get information about the specified authorization. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/user/authorizations/52141fa2e499b2229 e00009b --user [email protected]:password

URL Structure /broker/rest/user/authorizations/:id

JSON Response T he API returns information about the specified authorization and related resource links which have been left out for brevity. See Chapter 7, Authorizations for more information on all authorization parameters.

49

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "created_at": "2013-08-21T02:02:10Z", "expires_in": 2592000, "expires_in_seconds": 2592000, "id": "52141fa2e499b2229e00009b", "identity": "[email protected]", "note": "This is my UPDATED note to myself", "scopes": "userinfo", "token": "6c85ff7f619a964e260ee6def3fc5829128dbba3f8bc11a5d89178e0d6e7a163" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Display authorization" } ], "status": "ok", "type": "authorization", "version": "1.6" }

Report a bug

7.4. Update an Authorization


Description Update an existing authorization for the specified user account. However, currently this operation only supports updating the note parameter of an existing authorization. Method and URL Structure Method PUT Request Parameters Name note Description Reminder description of authorization. T ype String Required Yes Valid Options Not applicable Default Value Not applicable URL Structure /broker/rest/user/authorizations/:id

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/user/authorizations/52141fa2e499b2229 e00009b --user [email protected]:password --data-urlencode note=This is a note to myself

50

Chapter 7. Authorizations

T he API returns the authorizations resource with related resource links which have been left out for brevity. See Chapter 7, Authorizations for more information on all authorization parameters.
{ "api_version": 1.6, "data": { "created_at": "2013-08-21T02:02:10Z", "expires_in": 2592000, "expires_in_seconds": 2592000, "id": "52141fa2e499b2229e00009b", "identity": "[email protected]", "note": "This is a note to myself", "scopes": "userinfo", "token": "6c85ff7f619a964e260ee6def3fc5829128dbba3f8bc11a5d89178e0d6e7a163" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Change authorization" } ], "status": "ok", "type": "authorization", "version": "1.6" }

Report a bug

7.5. Delete an Authorization


Description Delete the specified authorization. Method and URL Structure Method DELET E Request Parameters Not applicable cURL Command Example
$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/user/authorizations/52141fa2e499b2229 e00009b --user [email protected]:password

URL Structure /broker/rest/user/authorizations/:id

JSON Response T he API returns confirmation of a successful DELET E operation.

51

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Authorization 52141fa2e499b2229e00009b is revoked." } ], "status": "ok", "type": null, "version": "1.6" }

Report a bug

52

Chapter 8. D omains

Chapter 8. Domains
T his chapter provides information on API resources to add, update, and manage OpenShift user domains. A domain must be created before an OpenShift application can be created. Domain names on OpenShift are non-strict, meaning there is no preceding period, and form part of the application name. T herefore, the syntax for the application name is ApplicationName-DomainName.rhcloud.com. T he table below describes each parameter associated with an OpenShift domain. Name nam e suffix allowed_gear_size s Report a bug Description Name of the domain Domain suffix Array of zero or more gear sizes allowed on this domain

8.1. Create a Domain


Description Create a new domain for an OpenShift user account. Note that a domain must be created before you can create OpenShift applications. Method and URL Structure Method POST Request Parameters Name nam e allowed_g ear_sizes Description Name of domain List of gear sizes that can be created on this domain T ype String String Required Yes No Valid Options Not applicable sm all; m edium ; large; c9 Default Value Not applicable Not applicable URL Structure /broker/rest/domains

Request
{ "name": "mydomain", "allowed_gear_sizes": "small" }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/domains/ --user [email protected]:password --data-urlencode name=mydomain --data-urlencode allowed_gear_sizes=small

JSON Response

53

OpenShift Online All Versions REST API Guide

T he API returns the domain resource with related resource links which have been left out for brevity. See Chapter 8, Domains for more information on all domain parameters.
{ "api_version": 1.6, "data": { "allowed_gear_sizes": [ "small" ], "creation_time": "2013-11-07T00:28:13Z", "id": "527ade9d7f9c48d371000009", "members": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "527ade897f9c48d371000001", "login": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "mydomain", "suffix": "rhcloud.com" }, "messages": [ { "exit_code": 0, "field": null, "index": null, "severity": "info", "text": "Created domain with name mydomain" } ], "status": "created", ], "type": "domain", "version": "1.6" }

Report a bug

8.2. List Domains


Description Get a list of all domains accessible to the user, regardless of ownership. Method and URL Structure Method GET URL Structure /broker/rest/domains

54

Chapter 8. D omains

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains --user [email protected]:password

JSON Response T he API returns a list of all domains that you have access to. T he related resource links returned by the API have been left out for brevity.
{ "api_version": 1.6, "data": [ { "allowed_gear_sizes": [ "small", "medium", "c9" ], "creation_time": "2013-08-20T07:21:50Z", "links": { }, "members": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "mydomain", "suffix": "rhcloud.com" } ], "messages": [], "status": "ok", "type": "domains", "version": "1.6" }

Report a bug

8.3. List Domains by Owner


55

OpenShift Online All Versions REST API Guide

Description Get a list of domains owned by a particular user, specified with the owner parameter. If no owner is specified, it automatically defaults to self. Method and URL Structure Method GET Request Parameters Name owner Description List domains owned by specified user, or @self for current user T ype String Required Yes Valid Options User Input; @ self Default Value Not applicable URL Structure /broker/rest/domains

Request
{ "owner": "@self" }

cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains --user [email protected]:password --data-urlencode owner=@self

JSON Response T he API returns a list of domains owned by the specified user. T he related resource links returned by the API have been left out for brevity.

56

Chapter 8. D omains

{ "api_version": 1.6, "data": [ { "allowed_gear_sizes": [ "small", "medium", "c9" ], "creation_time": "2013-08-20T07:21:50Z", "links": { }, "members": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "mydomain", "suffix": "rhcloud.com" } ], "messages": [], "status": "ok", "type": "domains", "version": "1.6" }

Report a bug

8.4. Get Domain Information


Description Get information about an existing domain. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example URL Structure /broker/rest/domains/:name

57

OpenShift Online All Versions REST API Guide

$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains/mydomain -user [email protected]:password

JSON Response T he API returns the domain resource with related resource links which have been left out for brevity. See Chapter 8, Domains for more information on all domain resource parameters.
$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains/mydomain -user [email protected]:password { "api_version": 1.6, "data": { "allowed_gear_sizes": [ "small" ], "creation_time": "2013-08-21T01:58:41Z", "members": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "mydomain", "suffix": "rhcloud.com" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found domain mydomain" } ], "status": "ok", "type": "domain", "version": "1.6" }

Report a bug

8.5. Update Domain


Description Update an existing domain.

58

Chapter 8. D omains

Method and URL Structure Method PUT Request Parameters Name nam e allowed_g ear_sizes Description Name of domain Array of zero or more gear sizes allowed on this domain T ype String String Required Yes No Valid Options Not applicable Not applicable Default Value Not applicable Not applicable URL Structure /broker/rest/domains/:name

Request
{ "name": "mydomainX", "allowed_gear_sizes": "small" }

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/domains/mydomain -user [email protected] --data-urlencode name=mydomainx --data-urlencode allowed_gear_sizes=small

JSON Response T he API returns the domain resource with related resource links which have been left out for brevity. See Chapter 8, Domains for more information on all domain parameters.

59

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "allowed_gear_sizes": [ "small" ], "creation_time": "2013-11-07T00:28:13Z", "id": "527ade9d7f9c48d371000009", "members": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "527ade897f9c48d371000001", "login": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "mydomainx", "suffix": "rhcloud.com" }, "messages": [ { "exit_code": 0, "field": null, "index": null, "severity": "info", "text": "Changed namespace to 'mydomainx'." } ], "status": "ok", ], "type": "domain", "version": "1.6" }

Report a bug

8.6. Delete a Domain


Description Delete an existing domain.

60

Chapter 8. D omains

Note
T he API will exit with an error message if there are applications within the domain to be deleted. T herefore, all applications must be deleted before deleting a domain. Setting the force parameter to true will automatically delete all applications under that domain, and then delete the domain.

Warning
Deleting a domain with the force parameter set to true will delete all applications created within that domain. T his operation cannot be reversed. Method and URL Structure Method DELET E Request Parameters Name force Description Force delete domain T ype Boolean Require d No Valid Options true ; false Default Value false URL Structure /broker/rest/domains/:name

cURL Command Example


$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/domains/mydomain --user [email protected]:password

JSON Response If there are applications under the domain to be deleted, the API exits with an error message.
{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 128, "field": null, "severity": "error", "text": "Domain contains applications. Delete applications first or set force to true." } ], "status": "unprocessable_entity", "type": null, "version": "1.6" }

In this case, delete all applications that exist under the domain or set the force parameter to true to

61

OpenShift Online All Versions REST API Guide

automatically delete the applications as part of the domain delete process. Report a bug

62

Chapter 9. Members

Chapter 9. Members
9.1. List Members of a Domain
Description Get a list of members that belong to the specified domain. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains/mydomain/members --user [email protected]:password

URL Structure /broker/rest/domains/:name/members

JSON Response T he API returns a list of all members belonging to the specified domain.

63

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": [ { "explicit_role": null, "from": [ { "type": "owner", "role": "admin" } ], "id": "521bf803656c674541000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found 1 member." } ], "status": "ok", "type": "members", "version": "1.6" }

Report a bug

9.2. Add or Remove Domain Members


Description Add or remove one or more domain members. Method and URL Structure Method PAT CH Request Parameters Name role id login Description T ype of role user has on the domain Unique user identifier User's login attribute T ype String String String Required Yes No No Valid Options view; edit; adm in Not applicable Not applicable Default Value Not applicable Not applicable Not applicable URL Structure /broker/rest/domains/:name/members

64

Chapter 9. Members

Request
{ "role": "view", "login": "[email protected]" }

cURL Command Example


$ curl -k -X PATCH https://openshift.redhat.com/broker/rest/domains/mydomain/members --user [email protected]:password --data-urlencode role=view --data-urlencode [email protected]

JSON Response T he sample JSON response below shows that a new domain member has been added.
{ "api_version": 1.6, "data": { "explicit_role": "view", "id": "526097602587c8242100006b", "login": "[email protected]", "owner": false, "role": "view", "type": "user" }, "messages": [ { "exit_code": 0, "field": null, "index": null, "severity": "info", "text": "Added 1 member." } ], "status": "ok", "type": "member", "version": "1.6" }

Report a bug

9.3. List Members of an Application


Description Get a list of members that belong to the specified application. Method and URL Structure Method GET URL Structure /broker/rest/application/:id/members

65

OpenShift Online All Versions REST API Guide

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/521bf818656c67309c000001/ members --user [email protected]:password

JSON Response T he API returns a list of all members belonging to the specified application.
{ "api_version": 1.6, "data": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "521bf803656c674541000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found 1 member." } ], "status": "ok", "type": "members", "version": "1.6" }

Report a bug

66

Chapter 10. Quickstarts

Chapter 10. Quickstarts


T his chapter provides information on API resources for OpenShift quickstart applications. Quickstarts provide quick access to new technology with code and libraries preconfigured, but you are responsible for updating the core libraries for security updates. T he table below describes each parameter associated with an OpenShift quickstart application. Name id search Report a bug Description Unique identifier of the quickstart. T he search term to use for the quickstart.

10.1. List Quickstarts


Description List all available quickstarts. T he client will only see this resource if there are quickstarts available, and it will be absent if there are none. Unlike other REST API calls, the following guidelines apply when retrieving a list of quickstarts: API versioning is not supported Only JSON is supported T he body of the API response is different from other API responses Parse errors or unexpected data values must be handled by omitting the entry Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://www.openshift.com/api/v1/quickstarts/promoted.json -user [email protected]

URL Structure /api/v1/quickstarts/promoted.json

JSON Response T he API returns a list of all quickstarts that are available. See Chapter 10, Quickstarts for more information on all quickstart parameters.

67

OpenShift Online All Versions REST API Guide

{ "data": [ { "quickstart": { "id": "13145", "href": "https://www.openshift.com/quickstarts/drupal-7", "name": "Drupal 7", "updated": "1365011911", "summary": "An open source content management platform written in PHP powering millions of websites and applications. It is built, used, and supported by an active and diverse community of people around the world. This quickstart will download and install the most recent stable version of Drupal and then generate a new site for you. Your administrative username and password will default to admin/openshift_changeme, so don't forget to alter them once you log in!\n\nWithout sharing a filesystem, Drupal can't be web scaled, but the README.md describes a workaround that will allow you to scale if you don't need direct file upload into Drupal.\n\nCreating this quickstart may take several minutes. You may need to restart the application once the database is configured. NOTE: If you want to run the Drupal cron tasks, please install the cron cartridge.", "body": "<p>An open source content management platform written in PHP powering millions of websites and applications. It is built, used, and supported by an active and diverse community of people around the world. This quickstart will download and install the most recent stable version of Drupal and then generate a new site for you. Your administrative username and password will default to admin/openshift_changeme, so don't forget to alter them once you log in!</p>\n\n<p>Without sharing a filesystem, Drupal can't be web scaled, but the <a href=\"https://github.com/openshift/drupalquickstart/blob/master/README.md\">README.md</a> describes a workaround that will allow you to scale if you don't need direct file upload into Drupal.</p>\n\n<p>Creating this quickstart may take several minutes. You may need to restart the application once the database is configured. NOTE: If you want to run the Drupal cron tasks, please install the cron cartridge.</p>", "cartridges": "php-*, mysql-*", "website": "http://drupal.org/", "tags": "cms, drupal, instant_app, not_scalable, php", "language": "PHP", "initial_git_url": "https://github.com/openshift/drupalquickstart.git", "provider": "openshift" } }, ] }

Report a bug

10.2. Show Quickstart


Description Get information about the specified quickstart. T he client does not have to retrieve the quickstarts list and scan for a known id. Method and URL Structure Method GET URL Structure /api/v1/quickstarts/:id

68

Chapter 10. Quickstarts

Request Parameters Name id Description Unique identifier of the quickstart T ype String Required Yes Valid Options Not applicable Default Value Not applicable

cURL Command Example


$ curl -k -X GET https://www.openshift.com/api/v1/quickstarts/12724 --user [email protected]

JSON Response T he API returns information about the specified quickstart.


{ "data": [ { "quickstart": { "id": "12724", "href": "https://www.openshift.com/quickstarts/wordpress-3x", "name": "WordPress 3.x", "updated": "1365011887", "summary": "A semantic personal publishing platform written in PHP with a MySQL back end, focusing on aesthetics, web standards, and usability. Currently using version 3.5.1.\n\nThe first time you access the app you'll be asked to set a username and password and give your blog a name. Be sure to track security updates from upstream.", "body": "<p>A semantic personal publishing platform written in PHP with a MySQL back end, focusing on aesthetics, web standards, and usability. Currently using version 3.5.1.</p>\n\n<p>The first time you access the app you'll be asked to set a username and password and give your blog a name. Be sure to track security updates from upstream.</p>", "cartridges": "php-*, mysql-*", "website": "http://wordpress.org", "tags": "blog, cms, instant_app, not_scalable", "language": "PHP", "initial_git_url": "git://github.com/openshift/wordpressexample.git", "provider": "openshift" } } ] }

Report a bug

10.3. Search Quickstarts


Description Search for a quickstart using a search term. Method and URL Structure

69

OpenShift Online All Versions REST API Guide

Method GET Request Parameters Name search

URL Structure /api/v1/quickstarts.json?search= search_term

Description Search term to use for the quickstart.

T ype String

Required Yes

Valid Options Not applicable

Default Value Not applicable

cURL Command Example


$ curl -k -X GET https://www.openshift.com/api/v1/quickstarts.json? search=wordpress --user [email protected]

JSON Response T he API returns information about all quickstarts that match the specified search string. See Chapter 10, Quickstarts for more information on all quickstart parameters.
{ "data": [ { "quickstart": { "id": "12724", "href": "https://www.openshift.com/quickstarts/wordpress-3x", "name": "WordPress 3.x", "updated": "1365011887", "summary": "A semantic personal publishing platform written in PHP with a MySQL back end, focusing on aesthetics, web standards, and usability. Currently using version 3.5.1.\n\nThe first time you access the app you'll be asked to set a username and password and give your blog a name. Be sure to track security updates from upstream.", "body": "<p>A semantic personal publishing platform written in PHP with a MySQL back end, focusing on aesthetics, web standards, and usability. Currently using version 3.5.1.</p>\n\n<p>The first time you access the app you'll be asked to set a username and password and give your blog a name. Be sure to track security updates from upstream.</p>", "cartridges": "php-*, mysql-*", "website": "http://wordpress.org", "tags": "blog, cms, instant_app, not_scalable", "language": "PHP", "initial_git_url": "git://github.com/openshift/wordpressexample.git", "provider": "openshift" } } ] }

Report a bug

70

Chapter 11. Applications

Chapter 11. Applications


T his chapter provides information on API resources that allow a client to create and manage OpenShift applications. OpenShift supports a number of application frameworks, such as PHP, JBoss, and Ruby. T he table below describes each parameter associated with an OpenShift application. Name nam e fram ework dom ain_id em bedded creation_tim e scalable gear_count gear_profile aliases app_url git_url ssh_url health_check_path uuid initial_git_url Report a bug Description Name of the application. Application framework. For example, JBoss, PHP, or Ruby. T he domain ID of the application. List of cartridges that have been added to this application. T ime the application was created. Whether application is scaled or not scaled. T he values are either true or false . Number of gears for this application. Gear size of an application. For example, sm all . Application server aliases, if applicable. T he URL to access this application. T he URL to access the Git repository for this application. T he URL to access this application using an SSH terminal. T he URL to check if the application is running. Unique identifier for this application. T he URL that was used to initialize the Git repository for this application.

11.1. Resolve DNS


Description Check whether the DNS is created with an actual DNS nameserver lookup that is not subject to caching. When DNS availability is checked with the client tools, the value gets cached for approximately 30 seconds. T his REST API call checks for DNS availability by directly querying the DNS servers. Method and URL Structure Method GET URL Structure /broker/rest/application/:id/dns_resolvable

Request Parameters Not applicable cURL Command Example


$ curl GET https://openshift.redhat.com/broker/rest/applications/534253991015616165707776 /dns_resolvable --user [email protected]

71

OpenShift Online All Versions REST API Guide

JSON Response If the DNS is resolvable the API returns the response shown below. If the DNS is not resolvable an error message is returned.
{ "api_version": 1.6, "data": true, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Resolved DNS myapplication-mydomain.rhcloud.com" } ], "status": "ok", "type": "boolean", "version": "1.6" }

Report a bug

11.2. Create an Application


Description Create a new application. Note that a domain must be created before creating an application. See Section 8.1, Create a Domain for more information on how to create a domain. Method and URL Structure Method POST URL Structure /broker/rest/domain/:name/applications

Request Parameters Name nam e cartridges Description Name of application Array of one or more cartridge names T ype String Array Require d Yes No Valid Options Not applicable nodejs-0.6 ; nodejs-0.10 ; python-3.3 ; python-2.7 ; python-3.3 ; python-2.7 ; python-2.6 ; zend-5.6 ; ruby1.9 ; ruby-1.8 ; jenkins-1 ; jbossews-2.0 ; jbossews-1.0 ; Default Value Not applicable Not applicable

72

Chapter 11. Applications

perl-5.10 ; php5.3 ; jbosseap6 ; diy-0.1 ; jbossas-7 scale gear_size initial_git _url Mark application as scalable Cartridge gear size URL to Git source code repository that is the basis for this application Name of cartridge Boolea n String String No No No true ; false sm all ; m edium URL; empty false sm all Not applicable

cartridges[ ][nam e]

String

No

nodejs-0.6 ; nodejs-0.10 ; python-3.3 ; python-2.7 ; python-2.6 ; zend-5.6 ; ruby1.9 ; ruby-1.8 ; jenkins-1 ; jbossews-2.0 ; jbossews-1.0 ; perl-5.10 ; php5.3 ; jbosseap6 ; diy-0.1 ; jbossas-7 sm all ; m edium

Not applicable

cartridges[ ][gear_size ]

Gear size of each individual cartridge. If gear_size is not specified, default gear size is used depending on user input URL to a downloadable cartridge; multiple URLs may be specified Add or update application environment variables

String

No

Not applicable

cartridges[ ][url]

String

No

Not applicable

Not applicable

environm ent _variables

String

No

Not applicable

Not applicable

Request
{ "name": "myapp", "cartridges": "ruby-1.9", "scale": "true", "gear_size": "small", "initial_git_url": "" }

73

OpenShift Online All Versions REST API Guide

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/domain/mydomain/applications --user [email protected]:password --data-urlencode name=myapp --data-urlencode cartridges=ruby-1.9 --data-urlencode scale=true --data-urlencode gear_size=small

In the above cURL command example, the gear_size parameter is applied to all cartridges that are added to the specified application. However, the cURL example below shows how to apply the gear_size parameter to individual cartridges when adding multiple cartridges to an application.
$ curl -k -X POST https://openshift.redhat.com/broker/rest/domain/mydomain/applications --user [email protected]:password --data-urlencode name=mysecondapp --data-urlencode cartridges=[][name]=jbosseap-6 --data-urlencode cartridges[][gear_size]=medium --data-urlencode cartridges[][name]=mysql-5.1 --data-urlencode cartridges[][gear_size]=small

JSON Response T he API returns information about the newly created application with related resource links which have been left out for brevity. See Chapter 11, Applications for more information on all application parameters.

74

Chapter 11. Applications

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapp.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapp was created." }, { "exit_code": 0, "field": null, "severity": "warning", "text": "HAProxy instance is started\n" } ], "status": "created", "type": "application",

75

OpenShift Online All Versions REST API Guide

"version": "1.6" }

Report a bug

11.3. List Applications for a User


Description List all applications for the specified user. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/applications --user [email protected]:password

URL Structure /broker/rest/applications

JSON Response T he API returns a list of all applications for the specified user. T he related resource links returned by the API have been left out for brevity. See Chapter 11, Applications for a description of each response parameter associated with an application.

76

Chapter 11. Applications

{ "api_version": 1.6, "data": [ { "aliases": [], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-20T07:21:50Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": {}, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminxcYKabL", "password": "IgsS3_wQYF38", "database_name": "myapp", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "php-5.3", "gear_count": 2, "gear_profile": "medium", "git_url": "ssh://[email protected]/~/git/myapp.git/", "health_check_path": "health_check.php", "id": "5213190e2587c8817a000121", "initial_git_url": null, "links": { }, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://[email protected]" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info",

77

OpenShift Online All Versions REST API Guide

"text": "Found 1 applications." } ], "status": "ok", "type": "applications", "version": "1.6" }

Report a bug

11.4. List Applications for a Domain


Description List all applications for the specified domain. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/domain/mydomain/applications --user [email protected]:password

URL Structure /broker/rest/domain/:name/applications

JSON Response T he API returns a list of all applications under the specified domain. T he related resource links returned by the API have been left out for brevity. See Chapter 11, Applications for a description of each response parameter associated with an application.

78

Chapter 11. Applications

{ "api_version": 1.6, "data": [ { "aliases": [], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-20T07:21:50Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": {}, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminxcYKabL", "password": "IgsS3_wQYF38", "database_name": "myapp", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "php-5.3", "gear_count": 2, "gear_profile": "medium", "git_url": "ssh://[email protected]/~/git/myapp.git/", "health_check_path": "health_check.php", "id": "5213190e2587c8817a000121", "initial_git_url": null, "links": { }, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://[email protected]" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info",

79

OpenShift Online All Versions REST API Guide

"text": "Found 1 applications." } ], "status": "ok", "type": "applications", "version": "1.6" }

Report a bug

11.5. List Applications and Cartridges


Description Get a list of all applications for the specified domain including all cartridges. Method and URL Structure Method GET URL Structure /broker/rest/domain/:name/applications?include=cartridges

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/domains/mydomain/applications? include=cartridges --user [email protected]

JSON Response T he API returns a list of all applications and embedded cartridges. T he related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for a description of each response parameter associated with an application.

80

Chapter 11. Applications

{ "api_version": 1.6, "data": [ { "aliases": [], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "cartridges": [ { "additional_gear_storage": 0, "base_gear_storage": 1, "collocated_with": [ "haproxy-1.4" ], "current_scale": 1, "description": "PHP is a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. Popular development frameworks include: CakePHP, Zend, Symfony, and Code Igniter.", "display_name": "PHP 5.3", "gear_profile": "medium", "help_topics": {}, "license": "The PHP License, version 3.0", "license_url": "http://www.php.net/license/3_0.txt", "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://[email protected]" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found 1 applications." } ], "status": "ok", "type": "applications", "version": "1.6" }

81

OpenShift Online All Versions REST API Guide

Report a bug

11.6. Get Application Information


Description Get information about an existing application. Method and URL Structure Method GET URL Structure /broker/rest/application/:id

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/52131ae36cec0e0d5f00012b

JSON Response T he API returns information about the specified application and related resource links which have been left out for brevity. See Chapter 11, Applications for more information on all application parameters.

82

Chapter 11. Applications

{ "api_version": 1.6, "data": [ { "aliases": [], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-20T07:29:39Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": {}, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminF3x1YFi", "password": "vja3unpGDueg", "database_name": "myapp", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "php-5.3", "gear_count": 2, "gear_profile": "medium", "git_url": "ssh://[email protected]/~/git/myapp.git/", "health_check_path": "health_check.php", "id": "52131ae36cec0e0d5f00012b", "initial_git_url": null, "links": { "GET": { "href": "https://openshift.redhat.com/broker/rest/applications/52131ae36cec0e0d5f00012b", "method": "GET", "optional_params": [], "rel": "Get application", "required_params": [] }, }, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "52054aef03ef64101000000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://52131ae36cec0e0d5f00012b@myapp-

83

OpenShift Online All Versions REST API Guide

mydomain.rhcloud.com" } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Found 1 applications." } ], "status": "ok", "type": "applications", "version": "1.6" }

Report a bug

11.7. Get Application and Cartridge Information


Description Get information about an existing application and its embedded cartridges. Method and URL Structure Method GET URL Structure /broker/rest/application/:id?include=cartridges

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/5213190e2587c8817a000121? include=cartridges --user [email protected]

JSON Response T he API returns information about the specified application and its embedded cartridges. T he related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

84

Chapter 11. Applications

{ "api_version": 1.6, "data": { "aliases": [], "app_url": "http://myapp-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "cartridges": [ { "additional_gear_storage": 0, "base_gear_storage": 1, "collocated_with": [ "haproxy-1.4" ], "current_scale": 1, "description": "PHP is a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. Popular development frameworks include: CakePHP, Zend, Symfony, and Code Igniter.", "display_name": "PHP 5.3", "gear_profile": "medium", "help_topics": {}, "license": "The PHP License, version 3.0", "license_url": "http://www.php.net/license/3_0.txt", "links": { "GET": { "href": "https://openshift.redhat.com/broker/rest/applications/5213190e2587c8817a000121/car tridges/php-5.3", "method": "GET", "optional_params": [], "rel": "Get cartridge", "required_params": [] }, "UPDATE": { "href": "https://openshift.redhat.com/broker/rest/applications/5213190e2587c8817a000121/car tridges/php-5.3", "method": "PUT", "optional_params": [ { "default_value": null, "description": "Additional filesystem storage in gigabytes on each gear having cartridge php-5.3", "name": "additional_gear_storage", "type": "integer", "valid_options": [] }, { "default_value": null, "description": "Minimum number of gears having cartridge php-5.3", "name": "scales_from", "type": "integer", "valid_options": [] }, { "default_value": null, "description": "Maximum number of gears having

85

OpenShift Online All Versions REST API Guide

cartridge php-5.3", "name": "scales_to", "type": "integer", "valid_options": [] } ], "rel": "Update cartridge configuration", "required_params": [] }, ........ "name": "php-5.3", "properties": [ { "name": "OPENSHIFT_TMP_DIR", "type": "environment", "description": "Directory to store application temporary files." }, ........ ], "scales_from": 1, "scales_to": -1, "scales_with": "haproxy-1.4", "status_messages": null, "supported_scales_from": 1, "supported_scales_to": -1, "tags": [ "service", "php", "web_framework" ], "type": "standalone", "url": null, "usage_rates": [], "version": "5.3", "website": "http://www.php.net" }, { "additional_gear_storage": 0, "base_gear_storage": 1, "collocated_with": [ "php-5.3" ], "current_scale": 1, "description": "Acts as a load balancer for your web cartridge and will automatically scale up to handle incoming traffic. Is automatically added to scaled applications when they are created and cannot be removed or added to an application after the fact.", "display_name": "OpenShift Web Balancer", "gear_profile": "medium", "help_topics": {}, "license": "GPLv2+", "license_url": "http://www.gnu.org/licenses/gpl-2.0.html", "links": { "GET": { "href": "https://openshift.redhat.com/broker/rest/applications/5213190e2587c8817a000121/car tridges/haproxy-1.4", "method": "GET", "optional_params": [],

86

Chapter 11. Applications

"rel": "Get cartridge", "required_params": [] }, ........ "name": "mysql-5.1", "properties": [ { "name": "username", "type": "cart_data", "description": "Root user on mysql database", "value": "adminxcYKabL" }, { "name": "password", "type": "cart_data", "description": "Password for root user on mysql database", "value": "IgsS3_wQYF38" }, { "name": "database_name", "type": "cart_data", "description": "MySQL DB name", "value": "myapp" }, { "name": "connection_url", "type": "cart_data", "description": "MySQL DB connection URL", "value": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } ], "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "status_messages": null, "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "service", "database", "embedded" ], "type": "embedded", "url": null, "usage_rates": [], "version": "5.1", "website": "http://www.mysql.com" } ], ........ "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" }

87

OpenShift Online All Versions REST API Guide

], "id": "520bd6bbdbd93c3dee00000d", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapp", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application 'myapp' found" } ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

11.8. Make an Application Highly Available (HA)


Description Make an application highly available (ha). Method and URL Structure Method POST URL Structure /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "make-ha" }

Description Event

T ype String

Required Yes

Valid Options m ake-ha

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/527ade9d7f9c48d37100000a/ events --user [email protected]:password --data-urlencode event=make-ha

88

Chapter 11. Applications

Report a bug

11.9. Start Application


Description Start an application that is not running. Method and URL Structure Method POST URL Structure /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "start" }

Description Event

T ype String

Required Yes

Valid Options start

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected]:password --data-urlencode event=start

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

89

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has started" }, { "exit_code": 0, "field": null, "severity": "warning", "text": "HAProxy instance is started\n" } ], "status": "ok",

90

Chapter 11. Applications

"type": "application", "version": "1.6" }

Report a bug

11.10. Stop Application


Description Stop a running application. Method and URL Structure Method POST URL Structure /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "stop" }

Description Event

T ype String

Required Yes

Valid Options stop

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=stop

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

91

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has stopped" }, { "exit_code": 0, "field": null, "severity": "warning", "text": "HAProxy instance is stopped\n" } ], "status": "ok",

92

Chapter 11. Applications

"type": "application", "version": "1.6" }

Report a bug

11.11. Force Stop Application


Description Force a running application to stop. Method and URL Structure Method POST URL Structure /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "force-stop" }

Description Event

T ype String

Required Yes

Valid Options force-stop

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected]:password --data-urlencode event=force-stop

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity.See Chapter 11, Applications for more information on all application parameters.

93

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has forcefully stopped" } ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

94

Chapter 11. Applications

11.12. Restart Application


Description Restart a running application. Method and URL Structure Method POST URL Structure /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "restart" }

Description Event

T ype String

Required Yes

Valid Options restart

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected]:password --data-urlencode event=restart

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

95

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has restarted" }, { "exit_code": 0, "field": null, "severity": "warning", "text": "Restarted HAProxy instance\n" } ], "status": "ok",

96

Chapter 11. Applications

"type": "application", "version": "1.6" }

Report a bug

11.13. Scale Up Application


Description Scale up an application that was created with the scaling function enabled. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "scale-up" }

Description Event

T ype String

Required Yes

Valid Options scale-up

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=scale-up

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

97

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 2, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has scaled up" } ], "status": "ok", "type": "application", "version": "1.6" }

T he API returns an error message if a user has reached the maximum number of gears allowed for their

98

Chapter 11. Applications

account, as shown in the sample response output below.


{ "status": "unprocessable_entity", "messages": [ { "field": null, "text": "[email protected] has already reached the gear limit of 3", "severity": "error", "exit_code": 104 } ] }

Report a bug

11.14. Scale Down Application


Description Scale down an application that was created with the scaling function enabled. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "scale-down" }

Description Event

T ype String

Required Yes

Valid Options scale-down

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=scale-down

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

99

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication has scaled down" } ], "status": "ok", "type": "application", "version": "1.6" }

T he API returns an error message if an application cannot be scaled down any further, as shown in the

100

Chapter 11. Applications

sample response output below.


{ "status": "unprocessable_entity", "messages": [ { "field": null, "text": "Failed to add event scale-down to application myapp due to: Cannot scale below minimum gear requirements for group '1'", "severity": "error", "exit_code": 1 } ] }

Report a bug

11.15. Tidy Application Framework


Description T idy the application framework. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "tidy" }

Description Event

T ype String

Required Yes

Valid Options tidy

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=tidy

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

101

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication called tidy" } ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

102

Chapter 11. Applications

11.16. Reload Application


Description Reload an application. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "reload" }

Description Event

T ype String

Required Yes

Valid Options reload

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=reload

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

103

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application myapplication called reload" }, { "exit_code": 0, "field": null, "severity": "warning", "text": "Reloaded HAProxy instance\n" } ], "status": "ok",

104

Chapter 11. Applications

"type": "application", "version": "1.6" }

Report a bug

11.17. Trigger Thread Dump


Description T rigger application thread dump. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/events

Request Parameters Name event Request


{ "event": "thread-dump" }

Description Event

T ype String

Required Yes

Valid Options thread-dum p

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ events --user [email protected] --data-urlencode event=thread-dump

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

105

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "" }, { "exit_code": 0, "field": null, "severity": "result", "text": "Success\nThe thread dump file will be available via: rhc tail myapplication -f /var/lib/openshift/534253991015616165707776/ruby//logs//error_log-20130821-* -o '-n 250'\n"

106

Chapter 11. Applications

} ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

11.18. Delete Application


Description Delete an OpenShift application. Method and URL Structure Method DELET E Resource URL /broker/rest/application/:id

Request Parameters Not applicable cURL Command Example


$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/application/534253991015616165707776 -user [email protected]

JSON Response
{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Application 534253991015616165707776 is deleted." } ], "status": "ok", "type": null, "version": "1.6" }

Report a bug

107

OpenShift Online All Versions REST API Guide

Chapter 12. Application Aliases and SSL Certificates


T his chapter provides information on API resources that allow a client to manage application aliases and SSL certificates for OpenShift applications. T he table below describes each parameter associated with an OpenShift application with aliases and SSL certificates added. Name id certificate_added_at Description Name of application alias. T he date and time when the SSL certificate was added.

has_private_ssl_certificat Indicates whether an SSL certificate has been added to the specified application. e Report a bug

12.1. Add Application Alias


Description Add an alias to an application, with the option to upload an SSL certificate. Adding an alias allows you to use your own domain name for an application. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/aliases

Request Parameters Name id ssl_certific ate private_key pass_phrase Description Alias for application Content of SSL certificate Required private key for SSL certificate Optional passphrase for private key T ype String String String String Required Yes No No No Valid Options Not applicable Not applicable Not applicable Not applicable Default Value Not applicable Not applicable Not applicable Not applicable

Request

108

Chapter 12. Application Aliases and SSL Certificates

{ "id": "myalias", "ssl_certificate": "-----BEGIN CERTIFICATE----\nMIIDoDCCAogCCQDzF8AJCHnrbjANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMC\nVVMxCzAJBgNVB AgMAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJl\nZGhhdDESMBAGA1UECwwJb3BlbnNo aWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAm\nBgkqhkiG9w0BCQEWGWluZm9Ab3BlbnNoaWZ0LnJlZGh hdC5jb20wHhcNMTMwMjE5\nMjExMTQ4WhcNMTQwMjE5MjExMTQ4WjCBkTELMAkGA1UEBhMCVVMxCzAJBgN VBAgM\nAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJlZGhhdDESMBAGA1UE\nCwwJb3Bl bnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAmBgkqhkiG9w0BCQEW\nGWluZm9Ab3BlbnNoaWZ0LnJ lZGhhdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB\nDwAwggEKAoIBAQDAEbH4MCi3iIDP1HS+/Xwu8S jdSc5WJX6htV7hJpmFZ8HohV/8\nba0v6aM9IJIIt+sIe2J62t/9G3leOdIHBxeACN4fV2l/iA/fvxvlnF KeD7sHm9Oc\nYj1H6YYJ57sIOf/oLDpJl6l3Rw8VC3+3W0/lzlVpA8qt7fpkiW7XQJCPplUSrdVC\n3ok Q2T5NAod5+wVIOqELgE5bLX1LRs5VPsjytHkJ7rKXs55FHR3kpsoImn5xD0Ky\n6lRn8cIMolQoyN5HIGr 8f5P+07hrHibve8jje/DKTssb5yEUAEmh6iGHQsRAnsUW\nQoIEUOLqQCu9re2No4G52Kl2xQIjyJF7rCf xAgMBAAEwDQYJKoZIhvcNAQEFBQAD\nggEBAGHrya/ZkiAje2kHsOajXMlO2+y1iLfUDcRLuEWpUa8sI5E M4YtemQrsupFp\n8lVYG5C4Vh8476oF9t8Wex5eH3ocwbSvPIUqE07hdmrubiMq4wxFVRYq7g9lHAnx\n l+bABuN/orbAcPcGAGg7AkXVoAc3Fza/ZcgMcw7NOtDTEss70V9OdgCfQUJL0KdO\nhCO8bQ1EaEiq6zE h8RpZe8mu+f/GYATX1I+eJUc6F6cn83oJjE9bqAVzk7TzTHeK\nEBKN50C14wWtXeG7n2+ugaVO+0xnvHe UrQBLHSRyOHqxXrQQ5XmzcaBiyI0f2IQM\nHst1BVXyX0n/L/ZoYYsv5juJmDo=\n-----END CERTIFICATE-----", "private_key": "-----BEGIN RSA PRIVATE KEY----\nMIIEogIBAAKCAQEAwBGx+DAot4iAz9R0vv18LvEo3UnOViV+obVe4SaZhWfB6IVf\n/G2tL+mjPSCSCL frCHtietrf/Rt5XjnSBwcXgAjeH1dpf4gP378b5ZxSng+7B5vT\nnGI9R+mGCee7CDn/6Cw6SZepd0cPF Qt/t1tP5c5VaQPKre36ZIlu10CQj6ZVEq3V\nQt6JENk+TQKHefsFSDqhC4BOWy19S0bOVT7I8rR5Ce6y l7OeRR0d5KbKCJp+cQ9C\nsupUZ/HCDKJUKMjeRyBq/H+T/tO4ax4m73vI43vwyk7LG+chFABJoeohh0L EQJ7F\nFkKCBFDi6kArva3tjaOBudipdsUCI8iRe6wn8QIDAQABAoIBAG/on4JVRRQSw8LU\nLiWt+jI7r yyoOUH2XL8JtzuGSwLwvomlVJT2rmbxQXx3Qr8zsgziHzIn30RRQrkF\nBXu0xRuDjzBBtSVqeJ1Mc4uo NncEAVxgjb5bewswZDnXPCGB8bosMtX4OPRXgdEo\nPwTtfjMOsrMaU3hd5Xu4m81tQA2BvwOlx8aYDyH 0jeTnervc5uRGbeTBQG4Bu40E\nrWNmXvgNq2EzTAwbbN6Ma97gw9KgXnM4Nlh29Fxb5TBeUU9lkzuTZA ZIDXKIm7AG\nUwMbj/A038yAumYQtThTE/3e4W3rn7F2Vko900bC4aAC1KQOAzjIeQqzqkVxWTWq\n4SUF QAECgYEA/ODwifOTuI6hdZK6JRgc4wp6Rc0fkqHuxLzABXoIGuSVlWyimqIN\nZySAkpo5EW6DNraRJxN COBmWeGPEhHGrea+JPiPEwCK0F7SxvSmg3jzNzw3Es31T\necET7eDwuSOY9v4XDzLyiXXkEUUReD7Ng2 hEYL+HaQrl5jWj4lxgq/ECgYEAwnCb\nKrz7FwX8AqtFAEi6uUrc12k1xYKQfrwSxbfdK2vBBUpgB71Iq/ fqP+1BittEljDG\n8f4jEtMBFfEPhLzGIHaI3UiHUHXS4GetA77TRgR8lnKKpj1FcMIY2iKU479707O5\n Q08pgWRUDQ8BVg2ePgbo5QjLMc/rv7UF3AHvPAECgYB/auAIwqDGN6gHU/1TP4ke\npWLi1O55tfpXSzv +BnUbB96PQgPUop7aP7xBIlBrBiI7aVZOOBf/qHT3CF421geu\n8tHWa7NxlIrl/vgn9lfGYyDYmXlpb1 amXLEsBVGGF/e1TGZWFDe9J5fZU9HvosVu\n1xTNIvSZ6xHYI2MGZcGYIQKBgEYeebaV5C7PV6xWu1F46O 19U9rS9DM//H/XryVi\nQv4vo7IWuj7QQe7SPsXC98ntfPR0rqoCLf/R3ChfgGsr8H8wf/bc+v9HHj8S5 E/f\ndy1e3Nccg2ej3PDm7jNsGSlwmmUkAQGHAL7KwYzcBm1UB+bycvZ1j2FtS+UckPpg\nMDgBAoGALD 8PkxHb4U4DtbNFSYRrUdvS9heav/yph3lTMfifNkOir36io6v8RPgb\nD2bHKKZgmYlTgJrxD45Er9agC 5jclJO35QRU/OfGf3GcnABkBI7vlvUKADAo65Sq\nweZkdJnbrIadcvLOHOzkKC9m+rxFTC9VoN1dwK2z wYvUXfa1VJA=\n-----END RSA PRIVATE KEY-----", "pass_phrase": "abcd" }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ aliases --user [email protected] --data-urlencode id=myalias

When adding an alias an SSL certificate can also be uploaded to allow secure HT T PS communication with an application. T o upload an SSL certificate include the required private key with or without the optional private key passphrase. T his can be done by cutting and pasting the contents of the SSL certificate and the key.

109

OpenShift Online All Versions REST API Guide

$ curl -k -X POST https://openshift.redhat.com/broker/rest/applications/534253991015616165707776 /aliases --user [email protected] --data-urlencode id=myalias --data-urlencode ssl_certificate=-----BEGIN CERTIFICATE----MIIDoDCCAogCCQDzF8AJCHnrbjANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMC VVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJl ZGhhdDESMBAGA1UECwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAm BgkqhkiG9w0BCQEWGWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wHhcNMTMwMjE5 MjExMTQ4WhcNMTQwMjE5MjExMTQ4WjCBkTELMAkGA1UEBhMCVVMxCzAJBgNVBAgM AkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJlZGhhdDESMBAGA1UE CwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAmBgkqhkiG9w0BCQEW GWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB DwAwggEKAoIBAQDAEbH4MCi3iIDP1HS+/Xwu8SjdSc5WJX6htV7hJpmFZ8HohV/8 ba0v6aM9IJIIt+sIe2J62t/9G3leOdIHBxeACN4fV2l/iA/fvxvlnFKeD7sHm9Oc Yj1H6YYJ57sIOf/oLDpJl6l3Rw8VC3+3W0/lzlVpA8qt7fpkiW7XQJCPplUSrdVC 3okQ2T5NAod5+wVIOqELgE5bLX1LRs5VPsjytHkJ7rKXs55FHR3kpsoImn5xD0Ky 6lRn8cIMolQoyN5HIGr8f5P+07hrHibve8jje/DKTssb5yEUAEmh6iGHQsRAnsUW QoIEUOLqQCu9re2No4G52Kl2xQIjyJF7rCfxAgMBAAEwDQYJKoZIhvcNAQEFBQAD ggEBAGHrya/ZkiAje2kHsOajXMlO2+y1iLfUDcRLuEWpUa8sI5EM4YtemQrsupFp 8lVYG5C4Vh8476oF9t8Wex5eH3ocwbSvPIUqE07hdmrubiMq4wxFVRYq7g9lHAnx l+bABuN/orbAcPcGAGg7AkXVoAc3Fza/ZcgMcw7NOtDTEss70V9OdgCfQUJL0KdO hCO8bQ1EaEiq6zEh8RpZe8mu+f/GYATX1I+eJUc6F6cn83oJjE9bqAVzk7TzTHeK EBKN50C14wWtXeG7n2+ugaVO+0xnvHeUrQBLHSRyOHqxXrQQ5XmzcaBiyI0f2IQM Hst1BVXyX0n/L/ZoYYsv5juJmDo= -----END CERTIFICATE----- --data-urlencode private_key=-----BEGIN RSA PRIVATE KEY----MIIEogIBAAKCAQEAwBGx+DAot4iAz9R0vv18LvEo3UnOViV+obVe4SaZhWfB6IVf /G2tL+mjPSCSCLfrCHtietrf/Rt5XjnSBwcXgAjeH1dpf4gP378b5ZxSng+7B5vT nGI9R+mGCee7CDn/6Cw6SZepd0cPFQt/t1tP5c5VaQPKre36ZIlu10CQj6ZVEq3V Qt6JENk+TQKHefsFSDqhC4BOWy19S0bOVT7I8rR5Ce6yl7OeRR0d5KbKCJp+cQ9C supUZ/HCDKJUKMjeRyBq/H+T/tO4ax4m73vI43vwyk7LG+chFABJoeohh0LEQJ7F FkKCBFDi6kArva3tjaOBudipdsUCI8iRe6wn8QIDAQABAoIBAG/on4JVRRQSw8LU LiWt+jI7ryyoOUH2XL8JtzuGSwLwvomlVJT2rmbxQXx3Qr8zsgziHzIn30RRQrkF BXu0xRuDjzBBtSVqeJ1Mc4uoNncEAVxgjb5bewswZDnXPCGB8bosMtX4OPRXgdEo PwTtfjMOsrMaU3hd5Xu4m81tQA2BvwOlx8aYDyH0jeTnervc5uRGbeTBQG4Bu40E rWNmXvgNq2EzTAwbbN6Ma97gw9KgXnM4Nlh29Fxb5TBeUU9lkzuTZAZIDXKIm7AG UwMbj/A038yAumYQtThTE/3e4W3rn7F2Vko900bC4aAC1KQOAzjIeQqzqkVxWTWq 4SUFQAECgYEA/ODwifOTuI6hdZK6JRgc4wp6Rc0fkqHuxLzABXoIGuSVlWyimqIN ZySAkpo5EW6DNraRJxNCOBmWeGPEhHGrea+JPiPEwCK0F7SxvSmg3jzNzw3Es31T ecET7eDwuSOY9v4XDzLyiXXkEUUReD7Ng2hEYL+HaQrl5jWj4lxgq/ECgYEAwnCb Krz7FwX8AqtFAEi6uUrc12k1xYKQfrwSxbfdK2vBBUpgB71Iq/fqP+1BittEljDG 8f4jEtMBFfEPhLzGIHaI3UiHUHXS4GetA77TRgR8lnKKpj1FcMIY2iKU479707O5 Q08pgWRUDQ8BVg2ePgbo5QjLMc/rv7UF3AHvPAECgYB/auAIwqDGN6gHU/1TP4ke pWLi1O55tfpXSzv+BnUbB96PQgPUop7aP7xBIlBrBiI7aVZOOBf/qHT3CF421geu 8tHWa7NxlIrl/vgn9lfGYyDYmXlpb1amXLEsBVGGF/e1TGZWFDe9J5fZU9HvosVu 1xTNIvSZ6xHYI2MGZcGYIQKBgEYeebaV5C7PV6xWu1F46O19U9rS9DM//H/XryVi Qv4vo7IWuj7QQe7SPsXC98ntfPR0rqoCLf/R3ChfgGsr8H8wf/bc+v9HHj8S5E/f dy1e3Nccg2ej3PDm7jNsGSlwmmUkAQGHAL7KwYzcBm1UB+bycvZ1j2FtS+UckPpg MDgBAoGALD8PkxHb4U4DtbNFSYRrUdvS9heav/yph3lTMfifNkOir36io6v8RPgb D2bHKKZgmYlTgJrxD45Er9agC5jclJO35QRU/OfGf3GcnABkBI7vlvUKADAo65Sq weZkdJnbrIadcvLOHOzkKC9m+rxFTC9VoN1dwK2zwYvUXfa1VJA= -----END RSA PRIVATE KEY---- --data-urlencode pass_phrase=abcd

JSON Response T he API returns the aliases resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 12, Application Aliases and SSL Certificates for all parameters associated with application aliases.

110

Chapter 12. Application Aliases and SSL Certificates

{ "api_version": 1.6, "data": { "certificate_added_at": "2013-08-20T00:00:00Z", "has_private_ssl_certificate": true, "id": "myalias" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added myalias to application myapplication" } ], "status": "created", "type": "alias", "version": "1.6" }

Report a bug

12.2. List Application Aliases


Description List all aliases and SSL certificates associated with the specified application.

Note
A GET request to an application also returns a list of associated aliases for that particular application . See Section 11.6, Get Application Information for more information. Method and URL Structure Method GET URL Structure /broker/rest/application/:id/aliases

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ aliases --user [email protected]

JSON Response T he API returns a list of all aliases and SSL certificates for the specified application. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 12, Application Aliases and SSL Certificates for a description of each response parameter

111

OpenShift Online All Versions REST API Guide

associated with application aliases.


{ "api_version": 1.6, "data": [ ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Listing aliases for application myapplication under domain mydomain" } ], "status": "ok", "type": "aliases", "version": "1.6" }

Report a bug

12.3. Get Application Alias Information


Description Get information about the specified application alias.

Note
A GET request to an application also returns a list of associated aliases for that particular application . See Section 11.6, Get Application Information for more information. Method and URL Structure Method GET URL Structure /broker/rest/application/:id/aliases/:id

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ aliases/myalias --user [email protected]

JSON Response T he API returns information about the specified alias. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 12, Application Aliases and SSL

112

Chapter 12. Application Aliases and SSL Certificates

Certificates for a description of each response parameter associated with application aliases.
{ "api_version": 1.6, "data": { "certificate_added_at": "2013-08-20T00:00:00Z", "has_private_ssl_certificate": true, "id": "myalias" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing alias myalias for application myapplication under domain mydomain" } ], "status": "ok", "type": "alias", "version": "1.6" }

Report a bug

12.4. Update Application Alias


Description Update an existing application alias with a new SSL certificate, or remove an existing certificate. Method and URL Structure Method PUT Resource URL /broker/rest/application/:id/aliases/:id

Request Parameters Name ssl_certific ate private_key pass_phrase Description Content of SSL certificate Required private key for SSL certificate Optional passphrase for private key T ype String String String Required Yes Yes No Valid Options Not applicable Not applicable Not applicable Default Value Not applicable Not applicable Not applicable

Request

113

OpenShift Online All Versions REST API Guide

{ "ssl_certificate": "-----BEGIN CERTIFICATE----\nMIIDoDCCAogCCQDzF8AJCHnrbjANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMC\nVVMxCzAJBgNVB AgMAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJl\nZGhhdDESMBAGA1UECwwJb3BlbnNo aWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAm\nBgkqhkiG9w0BCQEWGWluZm9Ab3BlbnNoaWZ0LnJlZGh hdC5jb20wHhcNMTMwMjE5\nMjExMTQ4WhcNMTQwMjE5MjExMTQ4WjCBkTELMAkGA1UEBhMCVVMxCzAJBgN VBAgM\nAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJlZGhhdDESMBAGA1UE\nCwwJb3Bl bnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAmBgkqhkiG9w0BCQEW\nGWluZm9Ab3BlbnNoaWZ0LnJ lZGhhdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB\nDwAwggEKAoIBAQDAEbH4MCi3iIDP1HS+/Xwu8S jdSc5WJX6htV7hJpmFZ8HohV/8\nba0v6aM9IJIIt+sIe2J62t/9G3leOdIHBxeACN4fV2l/iA/fvxvlnF KeD7sHm9Oc\nYj1H6YYJ57sIOf/oLDpJl6l3Rw8VC3+3W0/lzlVpA8qt7fpkiW7XQJCPplUSrdVC\n3ok Q2T5NAod5+wVIOqELgE5bLX1LRs5VPsjytHkJ7rKXs55FHR3kpsoImn5xD0Ky\n6lRn8cIMolQoyN5HIGr 8f5P+07hrHibve8jje/DKTssb5yEUAEmh6iGHQsRAnsUW\nQoIEUOLqQCu9re2No4G52Kl2xQIjyJF7rCf xAgMBAAEwDQYJKoZIhvcNAQEFBQAD\nggEBAGHrya/ZkiAje2kHsOajXMlO2+y1iLfUDcRLuEWpUa8sI5E M4YtemQrsupFp\n8lVYG5C4Vh8476oF9t8Wex5eH3ocwbSvPIUqE07hdmrubiMq4wxFVRYq7g9lHAnx\n l+bABuN/orbAcPcGAGg7AkXVoAc3Fza/ZcgMcw7NOtDTEss70V9OdgCfQUJL0KdO\nhCO8bQ1EaEiq6zE h8RpZe8mu+f/GYATX1I+eJUc6F6cn83oJjE9bqAVzk7TzTHeK\nEBKN50C14wWtXeG7n2+ugaVO+0xnvHe UrQBLHSRyOHqxXrQQ5XmzcaBiyI0f2IQM\nHst1BVXyX0n/L/ZoYYsv5juJmDo=\n-----END CERTIFICATE-----", "private_key": "-----BEGIN RSA PRIVATE KEY----\nMIIEogIBAAKCAQEAwBGx+DAot4iAz9R0vv18LvEo3UnOViV+obVe4SaZhWfB6IVf\n/G2tL+mjPSCSCL frCHtietrf/Rt5XjnSBwcXgAjeH1dpf4gP378b5ZxSng+7B5vT\nnGI9R+mGCee7CDn/6Cw6SZepd0cPF Qt/t1tP5c5VaQPKre36ZIlu10CQj6ZVEq3V\nQt6JENk+TQKHefsFSDqhC4BOWy19S0bOVT7I8rR5Ce6y l7OeRR0d5KbKCJp+cQ9C\nsupUZ/HCDKJUKMjeRyBq/H+T/tO4ax4m73vI43vwyk7LG+chFABJoeohh0L EQJ7F\nFkKCBFDi6kArva3tjaOBudipdsUCI8iRe6wn8QIDAQABAoIBAG/on4JVRRQSw8LU\nLiWt+jI7r yyoOUH2XL8JtzuGSwLwvomlVJT2rmbxQXx3Qr8zsgziHzIn30RRQrkF\nBXu0xRuDjzBBtSVqeJ1Mc4uo NncEAVxgjb5bewswZDnXPCGB8bosMtX4OPRXgdEo\nPwTtfjMOsrMaU3hd5Xu4m81tQA2BvwOlx8aYDyH 0jeTnervc5uRGbeTBQG4Bu40E\nrWNmXvgNq2EzTAwbbN6Ma97gw9KgXnM4Nlh29Fxb5TBeUU9lkzuTZA ZIDXKIm7AG\nUwMbj/A038yAumYQtThTE/3e4W3rn7F2Vko900bC4aAC1KQOAzjIeQqzqkVxWTWq\n4SUF QAECgYEA/ODwifOTuI6hdZK6JRgc4wp6Rc0fkqHuxLzABXoIGuSVlWyimqIN\nZySAkpo5EW6DNraRJxN COBmWeGPEhHGrea+JPiPEwCK0F7SxvSmg3jzNzw3Es31T\necET7eDwuSOY9v4XDzLyiXXkEUUReD7Ng2 hEYL+HaQrl5jWj4lxgq/ECgYEAwnCb\nKrz7FwX8AqtFAEi6uUrc12k1xYKQfrwSxbfdK2vBBUpgB71Iq/ fqP+1BittEljDG\n8f4jEtMBFfEPhLzGIHaI3UiHUHXS4GetA77TRgR8lnKKpj1FcMIY2iKU479707O5\n Q08pgWRUDQ8BVg2ePgbo5QjLMc/rv7UF3AHvPAECgYB/auAIwqDGN6gHU/1TP4ke\npWLi1O55tfpXSzv +BnUbB96PQgPUop7aP7xBIlBrBiI7aVZOOBf/qHT3CF421geu\n8tHWa7NxlIrl/vgn9lfGYyDYmXlpb1 amXLEsBVGGF/e1TGZWFDe9J5fZU9HvosVu\n1xTNIvSZ6xHYI2MGZcGYIQKBgEYeebaV5C7PV6xWu1F46O 19U9rS9DM//H/XryVi\nQv4vo7IWuj7QQe7SPsXC98ntfPR0rqoCLf/R3ChfgGsr8H8wf/bc+v9HHj8S5 E/f\ndy1e3Nccg2ej3PDm7jNsGSlwmmUkAQGHAL7KwYzcBm1UB+bycvZ1j2FtS+UckPpg\nMDgBAoGALD 8PkxHb4U4DtbNFSYRrUdvS9heav/yph3lTMfifNkOir36io6v8RPgb\nD2bHKKZgmYlTgJrxD45Er9agC 5jclJO35QRU/OfGf3GcnABkBI7vlvUKADAo65Sq\nweZkdJnbrIadcvLOHOzkKC9m+rxFTC9VoN1dwK2z wYvUXfa1VJA=\n-----END RSA PRIVATE KEY-----", "pass_phrase": "abcd" }

cURL Command Example When updating an application alias to upload a new SSL certificate, include the contents of the SSL certificate and the associated private key with or without the optional private key passphrase.

114

Chapter 12. Application Aliases and SSL Certificates

$ curl -k -X PUT https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ aliases/myalias --user [email protected] --data-urlencode ssl_certificate=----BEGIN CERTIFICATE----MIIDoDCCAogCCQDzF8AJCHnrbjANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMC VVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJl ZGhhdDESMBAGA1UECwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAm BgkqhkiG9w0BCQEWGWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wHhcNMTMwMjE5 MjExMTQ4WhcNMTQwMjE5MjExMTQ4WjCBkTELMAkGA1UEBhMCVVMxCzAJBgNVBAgM AkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJlZGhhdDESMBAGA1UE CwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAmBgkqhkiG9w0BCQEW GWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB DwAwggEKAoIBAQDAEbH4MCi3iIDP1HS+/Xwu8SjdSc5WJX6htV7hJpmFZ8HohV/8 ba0v6aM9IJIIt+sIe2J62t/9G3leOdIHBxeACN4fV2l/iA/fvxvlnFKeD7sHm9Oc Yj1H6YYJ57sIOf/oLDpJl6l3Rw8VC3+3W0/lzlVpA8qt7fpkiW7XQJCPplUSrdVC 3okQ2T5NAod5+wVIOqELgE5bLX1LRs5VPsjytHkJ7rKXs55FHR3kpsoImn5xD0Ky 6lRn8cIMolQoyN5HIGr8f5P+07hrHibve8jje/DKTssb5yEUAEmh6iGHQsRAnsUW QoIEUOLqQCu9re2No4G52Kl2xQIjyJF7rCfxAgMBAAEwDQYJKoZIhvcNAQEFBQAD ggEBAGHrya/ZkiAje2kHsOajXMlO2+y1iLfUDcRLuEWpUa8sI5EM4YtemQrsupFp 8lVYG5C4Vh8476oF9t8Wex5eH3ocwbSvPIUqE07hdmrubiMq4wxFVRYq7g9lHAnx l+bABuN/orbAcPcGAGg7AkXVoAc3Fza/ZcgMcw7NOtDTEss70V9OdgCfQUJL0KdO hCO8bQ1EaEiq6zEh8RpZe8mu+f/GYATX1I+eJUc6F6cn83oJjE9bqAVzk7TzTHeK EBKN50C14wWtXeG7n2+ugaVO+0xnvHeUrQBLHSRyOHqxXrQQ5XmzcaBiyI0f2IQM Hst1BVXyX0n/L/ZoYYsv5juJmDo= -----END CERTIFICATE----- --data-urlencode private_key=-----BEGIN RSA PRIVATE KEY----MIIEogIBAAKCAQEAwBGx+DAot4iAz9R0vv18LvEo3UnOViV+obVe4SaZhWfB6IVf /G2tL+mjPSCSCLfrCHtietrf/Rt5XjnSBwcXgAjeH1dpf4gP378b5ZxSng+7B5vT nGI9R+mGCee7CDn/6Cw6SZepd0cPFQt/t1tP5c5VaQPKre36ZIlu10CQj6ZVEq3V Qt6JENk+TQKHefsFSDqhC4BOWy19S0bOVT7I8rR5Ce6yl7OeRR0d5KbKCJp+cQ9C supUZ/HCDKJUKMjeRyBq/H+T/tO4ax4m73vI43vwyk7LG+chFABJoeohh0LEQJ7F FkKCBFDi6kArva3tjaOBudipdsUCI8iRe6wn8QIDAQABAoIBAG/on4JVRRQSw8LU LiWt+jI7ryyoOUH2XL8JtzuGSwLwvomlVJT2rmbxQXx3Qr8zsgziHzIn30RRQrkF BXu0xRuDjzBBtSVqeJ1Mc4uoNncEAVxgjb5bewswZDnXPCGB8bosMtX4OPRXgdEo PwTtfjMOsrMaU3hd5Xu4m81tQA2BvwOlx8aYDyH0jeTnervc5uRGbeTBQG4Bu40E rWNmXvgNq2EzTAwbbN6Ma97gw9KgXnM4Nlh29Fxb5TBeUU9lkzuTZAZIDXKIm7AG UwMbj/A038yAumYQtThTE/3e4W3rn7F2Vko900bC4aAC1KQOAzjIeQqzqkVxWTWq 4SUFQAECgYEA/ODwifOTuI6hdZK6JRgc4wp6Rc0fkqHuxLzABXoIGuSVlWyimqIN ZySAkpo5EW6DNraRJxNCOBmWeGPEhHGrea+JPiPEwCK0F7SxvSmg3jzNzw3Es31T ecET7eDwuSOY9v4XDzLyiXXkEUUReD7Ng2hEYL+HaQrl5jWj4lxgq/ECgYEAwnCb Krz7FwX8AqtFAEi6uUrc12k1xYKQfrwSxbfdK2vBBUpgB71Iq/fqP+1BittEljDG 8f4jEtMBFfEPhLzGIHaI3UiHUHXS4GetA77TRgR8lnKKpj1FcMIY2iKU479707O5 Q08pgWRUDQ8BVg2ePgbo5QjLMc/rv7UF3AHvPAECgYB/auAIwqDGN6gHU/1TP4ke pWLi1O55tfpXSzv+BnUbB96PQgPUop7aP7xBIlBrBiI7aVZOOBf/qHT3CF421geu 8tHWa7NxlIrl/vgn9lfGYyDYmXlpb1amXLEsBVGGF/e1TGZWFDe9J5fZU9HvosVu 1xTNIvSZ6xHYI2MGZcGYIQKBgEYeebaV5C7PV6xWu1F46O19U9rS9DM//H/XryVi Qv4vo7IWuj7QQe7SPsXC98ntfPR0rqoCLf/R3ChfgGsr8H8wf/bc+v9HHj8S5E/f dy1e3Nccg2ej3PDm7jNsGSlwmmUkAQGHAL7KwYzcBm1UB+bycvZ1j2FtS+UckPpg MDgBAoGALD8PkxHb4U4DtbNFSYRrUdvS9heav/yph3lTMfifNkOir36io6v8RPgb D2bHKKZgmYlTgJrxD45Er9agC5jclJO35QRU/OfGf3GcnABkBI7vlvUKADAo65Sq weZkdJnbrIadcvLOHOzkKC9m+rxFTC9VoN1dwK2zwYvUXfa1VJA= -----END RSA PRIVATE KEY---- --data-urlencode pass_phrase=abcd

JSON Response T he API returns the aliases resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 12, Application Aliases and SSL Certificates for all parameters associated with application aliases.

115

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "certificate_added_at": "2013-08-20T00:00:00Z", "has_private_ssl_certificate": true, "id": "myalias" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Updated myalias to application myapplication" } ], "status": "ok", "type": "alias", "version": "1.6" }

Report a bug

12.5. Delete Application Alias


Description Remove an alias from an application. Method and URL Structure Method DELET E Resource URL /broker/rest/application/:id/aliases/:id

Request Parameters Not applicable cURL Command Example


$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ aliases/myalias --user [email protected]

JSON Response

116

Chapter 12. Application Aliases and SSL Certificates

{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Removed myalias from application myapplication" } ], "status": "ok", "type": null, "version": "1.6" }

Report a bug

117

OpenShift Online All Versions REST API Guide

Chapter 13. Cartridges


T his chapter provides information on API resources that allow a client to manage OpenShift cartridges. Cartridges are the components of an OpenShift application, and include databases, build systems, and management capabilities. Adding a cartridge to an application provides the desired capability without having administer or update the included feature. T here are two types of cartridges available with OpenShift: standalone and embedded. Standalone Cartridges Standalone cartridges offer a variety of programming languages and frameworks for developing an application. Every application requires a framework cartridge. Examples include PHP, JBoss, and Ruby. T he table below describes each parameter associated with both standalone and embedded cartridges. Name nam e version license license_url website help_topics display_nam e description current_scale scales_from Description Name of the cartridge. Version of the packaged software in the cartridge. License of the packaged software in the cartridge. URL of the license file for the packaged software in the cartridge. Website URL for the packaged software in the cartridge. Map of topics and associated URLs that can provide help on how to use and configure the cartridge. Formatted name of the cartridge for user interfaces. Description of the cartridge for user interfaces. Current number of gears used to run the cartridge. Minimum number of gears that a cartridge can scale to; once reached, scale_down requests are rejected. Cannot be less than the supported_scales_from value. Maximum number of gears that a cartridge can scale to; once reached, scale_up requests are rejected. Cannot be greater than the supported_scales_to value. Names of other cartridges that scale with this cartridge and run on the same set of gears; currently only HAProxy-1.4 is available. Minimum number of gears supported by the cartridge; the scales_from value cannot be less than this number. Maximum number of gears supported by the cartridge; the scales_to value cannot be greater than this number. Array of tags associated with the cartridge. Plan usage costs. Status messages returned by the cartridge.

scales_to

scales_with supported_scales_from supported_scales_to tags usage_rates status_m essages

Note
T he scales_from and scales_to parameters can be set separately, or in the same REST API call. If the scales_from value is greater than the scales_to value, the broker logic automatically interchanges the two values.

118

Chapter 13. Cartridges

Embedded Cartridges Embedded cartridges provide extended functionality to OpenShift applications. Examples include MySQL, PostgreSQL, and Jenkins Client. T he table below describes each parameter associated with only embedded cartridges. Name additional_gear_stora ge base_gear_storage collocated_with gear_profile properties Description Set additional filesystem storage in gigabytes for the gear profile that the cartridge is running on. Default basic storage in gigabytes associated with the gear profile that the cartridge is running on. Array of names of other cartridges that share the same gear(s) with the cartridge. Size of the gears grouped in this profile that the cartridge is running on; all gears in a group will have the same gear_profile . List of environment variables and property values exposed by the cartridge and usable in application code.

Report a bug

13.1. List Cartridges


Description Get a list of all available OpenShift cartridges. Method and URL Structure Method GET Resource URL /broker/rest/cartridges

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/cartridges --user [email protected]

JSON Response T he API returns the cartridge resource with a list of all available OpenShift cartridges. Information on other available cartridges has been removed for brevity. See Chapter 13, Cartridges for more information on all cartridge parameters.

119

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": [ { "current_scale": 0, "description": "The Cron cartridge allows you to run command line programs at scheduled times. Use this for background jobs and periodic processing.", "display_name": "Cron 1.4", "help_topics": { "Getting Started Guide": "https://www.openshift.com/blogs/gettingstarted-with-cron-jobs-on-openshift" }, "license": "ASL 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt", "name": "cron-1.4", "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "embedded" ], "type": "embedded", "usage_rates": [], "version": "1.4", "website": "http://www.openshift.com/" }, { "current_scale": 0, "description": "Web based MySQL admin tool. Requires the MySQL cartridge to be installed first.", "display_name": "phpMyAdmin 3.4", "help_topics": {}, "license": "GPLv2", "license_url": "", "name": "phpmyadmin-3", "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "embedded" ], "type": "embedded", "usage_rates": [], "version": "3", "website": "http://www.phpmyadmin.net/" }, { "current_scale": 0, "description": "Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js is perfect for data-intensive real-time applications that run across distributed devices.", "display_name": "Node.js 0.10", "help_topics": { "Developer Center": "https://www.openshift.com/developers" },

120

Chapter 13. Cartridges

"license": "MIT License", "license_url": "https://raw.github.com/joyent/node/v0.6/LICENSE", "name": "nodejs-0.6", "scales_from": 1, "scales_to": -1, "scales_with": "haproxy-1.4", "supported_scales_from": 1, "supported_scales_to": -1, "tags": [ "service", "javascript", "nodejs", "web_framework" ], "type": "standalone", "usage_rates": [], "version": "0.6", "website": "http://www.nodejs.org/" }, ], "status": "ok", "type": "cartridges", "version": "1.6" }

Report a bug

13.2. Embedded Cartridges


Embedded cartridges can be added to an OpenShift application to extend functionality. For example, a MySQL cartridge can be added to an application to provide database support. Report a bug

13.2.1. Add Embedded Cartridge


Description Add an embedded cartridge to an application. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/cartridges

Request Parameters Name nam e Description Name of cartridge; note that valid options may be different from those shown here T ype String Required Yes Valid Options m ongodb-2.2 ; cron-1.4 ; m ysql-5.1 ; postgresql-9.2 ; haproxy-1.4 ; 10gen-m m sagent-0.1 ; Default Value Not applicable

121

OpenShift Online All Versions REST API Guide

phpm yadm in-4 ; m etrics-0.1 ; rockm ongo-1.1 ; jenkinsclient-1 colocate_ with scales_fr om scales_to Component to colocate with Minimum number of gears to run component Maximum number of gears to run component Additional GB of storage request on gears running this component Cartridge gear size URL to a downloadable cartridge Add or update application environment variables String String No No ruby-1.9 ; haproxy-1.4 Not applicable Not applicable Not applicable

String

No

Not applicable

Not applicable

additiona l_storage

String

No

Not applicable

Not applicable

gear_size url

String String

No No

sm all ; m edium Not applicable

Not applicable Not applicable

environm e nt_variab les Request


{

String

No

Not applicable

Not applicable

"name": "mysql-5.1", "colocate_with": "ruby-1.9", "gear_size": "small" }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges --user "user:Password" --data-urlencode name=mysql-5.1 --dataurlencode colocate_with=ruby-1.9 --data-urlencode gear_size=small

JSON Response T he API returns the embedded cartridge resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 13, Cartridges for more information on all cartridge parameters.

122

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "additional_gear_storage": 0, "base_gear_storage": 1, "collocated_with": [ "ruby-1.9", "haproxy-1.4" ], "current_scale": 1, "description": "MySQL is a multi-user, multi-threaded SQL database server.", "display_name": "MySQL Database 5.1", "gear_profile": "small", "help_topics": { }, "license": "GPL", "license_url": "", "name": "mysql-5.1", "properties": [ { "name": "username", "type": "cart_data", "description": "Root user on mysql database", "value": "adminthGnHLU" }, { "name": "password", "type": "cart_data", "description": "Password for root user on mysql database", "value": "dPFjWLrUjfxC" }, { "name": "database_name", "type": "cart_data", "description": "MySQL DB name", "value": "myapplication" }, { "name": "connection_url", "type": "cart_data", "description": "MySQL DB connection URL", "value": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } ], "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "status_messages": null, "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "service", "database", "embedded" ], "type": "embedded", "url": null, "usage_rates": [ ],

123

OpenShift Online All Versions REST API Guide

"version": "5.1", "website": "http://www.mysql.com" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added mysql-5.1 to application myapplication" }, { "exit_code": 0, "field": null, "severity": "debug", "text": "\n\nmysql-5.1: Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT\n" },

Report a bug

13.2.2. List Embedded Cartridges


Description Get a list of embedded cartridges that have been added to an application. For scaled applications, the API also returns the scaling properties of the cartridge.

Note
List of all embedded cartridges can also be retrieved with the LIST _APPLICAT IONS resource. See Section 11.5, List Applications and Cartridges for more information. Method and URL Structure Method GET Resource URL /broker/rest/application/:id/cartridges

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges --user [email protected]

JSON Response T he API returns a list of all embedded cartridges that have been added to the specified application. Related resource links and other cartridges returned by the API have been removed for brevity. See Chapter 13, Cartridges for more information on all cartridge parameters.

124

Chapter 13. Cartridges

{ "api_version": 1.6, "data": [ { "additional_gear_storage": 10, "base_gear_storage": 1, "collocated_with": [ "haproxy-1.4" ], "current_scale": 1, "description": "Ruby is a dynamic, reflective, general-purpose objectoriented programming language. Popular development frameworks include Ruby on Rails and Sinatra.", "display_name": "Ruby 1.9", "gear_profile": "small", "help_topics": { }, "license": "Ruby BSDL", "license_url": "http://www.ruby-lang.org/en/about/license.txt", "links": { "GET": { "href": "https://openshift.redhat.com/broker/rest/application/527ade9d7f9c48d37100000a/car tridge/ruby-1.9", "method": "GET", "optional_params": [ ], "rel": "Get cartridge", "required_params": [ ] }, "UPDATE": { "href": "https://openshift.redhat.com/broker/rest/application/527ade9d7f9c48d37100000a/car tridge/ruby-1.9", "method": "PUT", "optional_params": [ { "default_value": null, "description": "Additional filesystem storage in gigabytes on each gear having cartridge ruby-1.9", "name": "additional_gear_storage", "type": "integer", "valid_options": [ ] }, { "default_value": null, "description": "Minimum number of gears having cartridge ruby-1.9", "name": "scales_from", "type": "integer", "valid_options": [ ] }, { "default_value": null,

125

OpenShift Online All Versions REST API Guide

"description": "Maximum number of gears having cartridge ruby-1.9", "name": "scales_to", "type": "integer", "valid_options": [ ] } ], "rel": "Update cartridge configuration", "required_params": [ ........

Report a bug

13.2.3. Get Cartridge Information


Description Get information for the specified cartridge. Method and URL Structure Method GET Resource URL /broker/rest/application/:id/cartridges/:name

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1 --user [email protected]

JSON Response T he API returns the embedded cartridge resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 13, Cartridges for more information on all cartridge parameters.

126

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "additional_gear_storage": 0, "base_gear_storage": 1, "collocated_with": [ "ruby-1.9", "haproxy-1.4" ], "current_scale": 1, "description": "MySQL is a multi-user, multi-threaded SQL database server.", "display_name": "MySQL Database 5.1", "gear_profile": "small", "help_topics": { }, "license": "GPL", "license_url": "", "name": "mysql-5.1", "properties": [ { "name": "username", "type": "cart_data", "description": "Root user on mysql database", "value": "adminthGnHLU" }, { "name": "password", "type": "cart_data", "description": "Password for root user on mysql database", "value": "dPFjWLrUjfxC" }, { "name": "database_name", "type": "cart_data", "description": "MySQL DB name", "value": "myapplication" }, { "name": "connection_url", "type": "cart_data", "description": "MySQL DB connection URL", "value": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } ], "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "status_messages": null, "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "service", "database", "embedded" ], "type": "embedded", "url": null, "usage_rates": [ ],

127

OpenShift Online All Versions REST API Guide

"version": "5.1", "website": "http://www.mysql.com" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing cartridge mysql-5.1 for application myapplication under domain mydomain" } ], "status": "ok", "type": "cartridge", "version": "1.6" }

Report a bug

13.2.4. Update Cartridge Configuration


Description Update the configuration of an existing cartridge. Minimum and maximum scaling factors and additional filesystem storage in gigabytes on each gear that contains the specified cartridge can be set with this API resource.

Note
An upgraded plan is required to configure additional gear storage. Visit www.openshift.com and log into your account to view plan upgrade options. Method and URL Structure Method PUT Resource URL /broker/rest/application/:id/cartridges/:name

Request Parameters Name additional_gear_stor age scales_from scales_to Description Additional filesystem storage (GB) Min number of gears Max number of gears T ype Integer Require d No Valid Options Not applicable Default Value Not applicable Not applicable Not applicable

Integer Integer

No No

Not applicable Not applicable

Request

128

Chapter 13. Cartridges

{ "additional_gear_storage": 10 }

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1 --user [email protected] --data-urlencode additional_gear_storage=10

JSON Response T he API returns the embedded cartridge resource with related resource links, and the updated values for the parameters that were changed. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 13, Cartridges for more information on all cartridge parameters.

129

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "additional_gear_storage": 10, "base_gear_storage": 1, "collocated_with": [ "ruby-1.9", "haproxy-1.4" ], "current_scale": 1, "description": "MySQL is a multi-user, multi-threaded SQL database server.", "display_name": "MySQL Database 5.1", "gear_profile": "small", "help_topics": { }, "license": "GPL", "license_url": "", "name": "mysql-5.1", "properties": [ { "name": "username", "type": "cart_data", "description": "Root user on mysql database", "value": "adminthGnHLU" }, { "name": "password", "type": "cart_data", "description": "Password for root user on mysql database", "value": "dPFjWLrUjfxC" }, { "name": "database_name", "type": "cart_data", "description": "MySQL DB name", "value": "myapplication" }, { "name": "connection_url", "type": "cart_data", "description": "MySQL DB connection URL", "value": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } ], "scales_from": 1, "scales_to": 1, "scales_with": "haproxy-1.4", "status_messages": null, "supported_scales_from": 1, "supported_scales_to": 1, "tags": [ "service", "database", "embedded" ], "type": "embedded", "url": null, "usage_rates": [ ],

130

Chapter 13. Cartridges

"version": "5.1", "website": "http://www.mysql.com" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing cartridge mysql-5.1 for application myapplication under domain mydomain" } ], "status": "ok", "type": "cartridge", "version": "1.6" }

T he API returns an error message if the user account does not allow additional gear storage.
{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 164, "field": null, "severity": "error", "text": "You are not allowed to request additional gear storage" } ], "status": "unprocessable_entity", "type": null, "version": "1.6" }

Report a bug

13.2.5. Get Cartridge Status


Description Retrieve the status_m essages string as an array for the specified cartridge in an application. Method and URL Structure Method GET Resource URL /broker/rest/domain/:name/applications/:name/cartridges/:name

Request Parameters Not applicable cURL Command Example

131

OpenShift Online All Versions REST API Guide

JSON Response T he API returns the status_m essages string as an array for the specified cartridge in an application. Unnecessary information and related resource links returned by the API have been removed for brevity.

"status_messages": [ { "gear_id": "51142f5adbd93ce16a0005c4", "message": "MySQL is running\n" } ],

Report a bug

13.2.6. Start Cartridge


Description Start an application's embedded cartridge that is not running. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/cartridges/:name/events

Request Parameters Name event Request


{ "event": "start" }

Description Event

T ype String

Required Yes

Valid Options start

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1/events --user [email protected] --data-urlencode event=start

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

132

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { }, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminthGnHLU", "password": "dPFjWLrUjfxC", "database_name": "myapplication", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added start on mysql-5.1 for application myapplication"

133

OpenShift Online All Versions REST API Guide

} ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

13.2.7. Stop Cartridge


Description Stop an application's embedded cartridge that is running. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/cartridges/:name/events

Request Parameters Name event Request


{ "event": "stop" }

Description Event

T ype String

Required Yes

Valid Options stop

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1/events --user [email protected] --data-urlencode event=stop

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

134

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { }, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminthGnHLU", "password": "dPFjWLrUjfxC", "database_name": "myapplication", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added stop on mysql-5.1 for application myapplication"

135

OpenShift Online All Versions REST API Guide

} ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

13.2.8. Restart Cartridge


Description Restart a running embedded cartridge. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/cartridges/:name/events

Request Parameters Name event Request


{ "event": "restart" }

Description Event

T ype String

Required Yes

Valid Options restart

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1/events --user [email protected] --data-urlencode event=restart

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

136

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { }, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminthGnHLU", "password": "dPFjWLrUjfxC", "database_name": "myapplication", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added restart on mysql-5.1 for application myapplication"

137

OpenShift Online All Versions REST API Guide

} ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

13.2.9. Reload Cartridge


Description Reload the embedded cartridge configuration if it has been modified. Method and URL Structure Method POST Resource URL /broker/rest/application/:id/cartridges/:name/events

Request Parameters Name event Request


{ "event": "reload" }

Description Event

T ype String

Required Yes

Valid Options reload

Default Value Not applicable

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1/events --user [email protected] --data-urlencode event=reload

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

138

Chapter 13. Cartridges

{ "api_version": 1.6, "data": { "aliases": [ ], "app_url": "http://myapplication-mydomain.rhcloud.com/", "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-08-21T01:58:41Z", "domain_id": "mydomain", "embedded": { "haproxy-1.4": { }, "mysql-5.1": { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminthGnHLU", "password": "dPFjWLrUjfxC", "database_name": "myapplication", "info": "Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/" } }, "framework": "ruby-1.9", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health", "id": "534253991015616165707776", "initial_git_url": null, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "5213a826e499b22f15000001", "name": "[email protected]", "owner": true, "role": "admin", "type": "user" } ], "name": "myapplication", "scalable": true, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added reload on mysql-5.1 for application myapplication"

139

OpenShift Online All Versions REST API Guide

} ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

13.2.10. Delete Cartridge


Description Delete an embedded cartridge from an application. Method and URL Structure Method DELET E Resource URL /broker/rest/application/:id/cartridges/:name

Request Parameters Not applicable cURL Command Example


$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ cartridges/mysql-5.1 --user [email protected]

JSON Response
{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Removed mysql-5.1 from application myapplication" } ], "status": "ok", "type": null, "version": "1.6" }

Report a bug

14 0

Chapter 14. D eployment

Chapter 14. Deployment


T he deployment API resource contains information about each application deployment. T he table below describes each parameter associated with an application deployment. Name id created_at hot_deploy force_clean_build ref artifact_url activations Report a bug Description Application deployment ID Creation time of application Indicates whether the hot deployment was enabled for this deployment Indicates whether a clean build was performed for this deployment Git reference such as tag, branch, or commit ID A binary deployment artifact An array of activations

14.1. List Application Deployments


Description Get a list of deployments for the specified application. Method and URL Structure Method GET Request Parameters Not applicable cURL Command Example
$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/5255b678b78bba421d000008/ deployments --user [email protected]:password

Resource URL /broker/rest/application/:id/deployments

JSON Response T he API returns a list of deployments for the specified application. See Chapter 14, Deployment for more information on all application deployment parameters.

14 1

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": [ { "activations": [ "2013-10-09T20:07:35Z" ], "created_at": "2013-10-09T20:07:23Z", "force_clean_build": false, "hot_deploy": false, "id": "4e2d9a82", "ref": "master", "sha1": "86a5e8d" } ], "messages": [ { "exit_code": 0, "field": null, "index": null, "severity": "info", "text": "Listing deployments for application myapplication under domain mydomain" } ], "status": "ok", "type": "deployments", "version": "1.6" }

Report a bug

14.2. Deploy an Application


Description Deploy the specified application. Method and URL Structure Method POST Request Parameters Name ref Description Git reference, such as tag, branch, or commit ID T ype String Required No Valid Options Not applicable Default Value m aster Resource URL /broker/rest/application/:id/deployments

artifact_u URL from where the deployment artifact rl is to be downloaded hot_deplo Indicates whether

String

No

Not applicable

Not applicable

String

No

true ; false

false

14 2

Chapter 14. D eployment

y force_cle an_build

this is a hot deployment Indicates whether a clean build is to be performed String No true ; false false

Request
{ "ref": "master", "hot_deploy": false, "force_clean_build": false }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/5255b678b78bba421d000008/ deployments --user [email protected]:password --data-urlencode ref=master -data-urlencode hot_deploy=false --data-urlencode force_clean_build=false

JSON Response T he API returns the deployment resource. See Chapter 14, Deployment for more information on all deployment parameters.
{ "api_version": 1.6, "data": { "activations": [ "2013-10-09T20:07:16Z" ], "created_at": "2013-10-09T20:07:03Z", "force_clean_build": false, "hot_deploy": false, "id": "4e2d9a82", "ref": "master", "sha1": "86a5e8d" }, "messages": [ { "exit_code": 0, "field": null, "index": null, "severity": "info", "text": "Added 4e2d9a82 to application myapplication" } ], "status": "created", "type": "deployment", "version": "1.6" }

Report a bug

14 3

OpenShift Online All Versions REST API Guide

14.3. Activate a Deployment of an Application


Description Activate a particular deployment for the specified application. Method and URL Structure Method POST Request Parameters Name event deploym en t_id Description Event Deployment ID to activate the application T ype String String Required Yes Yes Valid Options activate User input Default Value Not applicable Not applicable Resource URL /broker/rest/application/:id/events

Request
{ "event": "activate", "deployment_id": "f36f59c0" }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/528424f6dbd93c204d000001/ events --user [email protected]:password --data-urlencode event=activate -data-urlencode deployment_id=56e71f70

JSON Response T he API returns the application resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 11, Applications for more information on all application parameters.

14 4

Chapter 14. D eployment

{ "api_version": 1.6, "data": { "aliases": [], "app_url": "http://myapplication-mydomain.rhcloud.com/", "auto_deploy": true, "build_job_url": null, "building_app": null, "building_with": null, "creation_time": "2013-11-14T01:18:46Z", "deployment_branch": "master", "deployment_type": "git", "domain_id": "mydomain", "embedded": {}, "framework": "php-5.3", "gear_count": 1, "gear_profile": "small", "git_url": "ssh://[email protected]/~/git/myapplication.git/", "health_check_path": "health_check.php", "id": "528424f6dbd93c204d000001", "initial_git_url": null, "keep_deployments": 10, "links": { "GET": { "href": "https://openshift.redhat.com/broker/rest/application/528424f6dbd93c204d000001", "method": "GET", "optional_params": [], "rel": "Get application", "required_params": [] }, }, "members": [ { "explicit_role": null, "from": [ { "type": "domain", "role": "admin" } ], "id": "520bd6bbdbd93c3dee00000d", "login": "[email protected]", "owner": true, "role": "admin", "type": "user" }, ], "name": "myapplication", "scalable": false, "ssh_url": "ssh://[email protected]" }, "messages": [ { "exit_code": 0, "field": null,

14 5

OpenShift Online All Versions REST API Guide

"index": null, "severity": "info", "text": "Deployment ID 56e71f70 on application myapplication has been activated" } ], "status": "ok", "type": "application", "version": "1.6" }

Report a bug

14 6

Chapter 15. Environment Variables

Chapter 15. Environment Variables


T his chapter provides information on API resources that allow a client to add and manage user defined application environment variables. T he environment variables can be set when an application is created, when a cartridge is added to an application, or they can be added to an existing application. User defined environment variables are persistent and replicated through all application gears, including new gears added in scaling events. T he table below describes each parameter associated with OpenShift environment variables. Name nam e value Report a bug Description Name of the environment variable Value of the environment variable

15.1. Add Environment Variable


Description Add an environment variable to the specified application. Method and URL Structure Method POST Request Parameters Name nam e Description Name of environment variable Value of environment variable T ype String Required No Valid Options Not applicable Default Value Not applicable URL Structure /broker/rest/application/:id/environment-variables

value

String

No

Not applicable

Not applicable

Request
{ "name": "MY_ENV_VAR", "value": "myvalue" }

cURL Command Example


$ curl -k -X POST https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ environment-variables --user [email protected]:password --data-urlencode name=MY_ENV_VAR --data-urlencode value=myvalue

JSON Response

14 7

OpenShift Online All Versions REST API Guide

T he API returns the environment variables resource with related resource links which have been left out for brevity. See Chapter 15, Environment Variables for more information on all parameters for environment variables.
{ "api_version": 1.6, "data": { "name": "MY_ENV_VAR", "value": "myvalue" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Added environment variable 'MY_ENV_VAR' to application myapp" } ], "status": "created", "type": "environment-variable", "version": "1.6" }

Environment variables can also be added during application creation or when adding a cartridge to an application. See Section 11.2, Create an Application for more information on adding environment variables when creating an application. See Section 13.2.1, Add Embedded Cartridge for more information on adding environment variables when adding a cartridge to an application. Report a bug

15.2. List Environment Variables


Description Get a list of all environment variables associated with the specified application. Method and URL Structure Method GET Resource URL /broker/rest/application/:id/environment-variables

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ environment-variables --user [email protected]

14 8

Chapter 15. Environment Variables

JSON Response T he API returns the environment variables resource with a list of all available environment variables for the specified application. Unnecessary information and other resource links have been removed for brevity. See Chapter 15, Environment Variables for more information on all parameters for environment variables.
{ "api_version": 1.6, "data": { "name": "MY_ENV_VAR", "value": "myvalue" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing environment variable 'MY_ENV_VAR' for application myapp" } ], "status": "ok", "type": "environment-variable", "version": "1.6" }

Report a bug

15.3. Get Environment Variable Information


Description Get information about the specified environment variable. Method and URL Structure Method GET Resource URL /broker/rest/application/:id/environment-variables/ENV_VAR_NAME

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ environment-variables/MY_ENV_VAR --user [email protected]

JSON Response T he API returns information about the specified environment variable. Unnecessary information and other resource links have been removed for brevity. See Chapter 15, Environment Variables for more information on all parameters for environment variables.

14 9

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": { "name": "MY_ENV_VAR", "value": "myvalue" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing environment variable 'MY_ENV_VAR' for application myapp" } ], "status": "ok", "type": "environment-variable", "version": "1.6" }

Report a bug

15.4. Update Environment Variable


Description Update the value of an existing environment variable. Method and URL Structure Method PUT Request Parameters Name value Description Value of environment variable T ype String Required Yes Valid Options Not applicable Default Value Not applicable URL Structure /broker/rest/application/:id/environment-variables/ENV_VAR_NAME

Request
{ "value": "mynewvalue" }

cURL Command Example


$ curl -k -X PUT https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ environment-variables/MY_ENV_VAR --user [email protected] --data-urlencode value=mynewvalue

JSON Response

150

Chapter 15. Environment Variables

T he API returns the environment variables resource with related resource links which have been left out for brevity. See Chapter 15, Environment Variables for more information on all parameters for environment variables.
{ "api_version": 1.6, "data": { "name": "MY_ENV_VAR", "value": "mynewvalue" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Updated environment variable 'MY_ENV_VAR' in application myapp" } ], "status": "ok", "type": "environment-variable", "version": "1.6" }

Report a bug

15.5. Delete Environment Variable


Description Delete an existing environment variable. Method and URL Structure Method DELET E Resource URL /broker/rest/application/:id/environment-variables/ENV_VAR_NAME

Request Parameters Not applicable cURL Command Example


$ curl -k -X DELETE https://openshift.redhat.com/broker/rest/application/534253991015616165707776/ environment-variables/MY_ENV_VAR --user [email protected]

JSON Response

151

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": null, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Removed environment variable 'MY_ENV_VAR' from application myapp" } ], "status": "ok", "type": null, "version": "1.6" }

Report a bug

152

Chapter 16. Gear Groups

Chapter 16. Gear Groups


Gear groups are of the same size and share scaling limit in terms of maximum number of gears. A gear group is automatically created when a scaled application is created, or when a cartridge is added to a scaled application. For an application that is not scalable, only one gear group gets created. All cartridges in a gear group scale together. Report a bug

16.1. Get Application Gear Groups


Description Get a list of gear groups where each group represents a list of gears that share scaling and storage policies.

Note
Section 13.2.2, List Embedded Cartridges provides information on how to view scaling and storage policies for scaled cartridges. Method and URL Structure Method GET URL Structure /broker/rest/application/:id/gear_groups

Request Parameters Not applicable cURL Command Example


$ curl -k -X GET https://openshift.redhat.com/broker/rest/application/5213190e2587c8817a000121/ gear_groups --user [email protected]

Note
If the scales_from value is set higher than the m ax_gear limit for your subscription plan, the API returns an error message. T his is because OpenShift will attempt to scale up to the scales_from value. If an application demands more resources, and a higher minimum scaling limit is required that exceeds your current subscription plan, the plan must be upgraded. Log onto your account at www.openshift.com, and go to the Your Plan page to view upgrade options. JSON Response T he API returns a list of all gear groups for the specified application. See Chapter 13, Cartridges for more information on all cartridge parameters.

153

OpenShift Online All Versions REST API Guide

{ "api_version": 1.6, "data": [ { "additional_gear_storage": 0, "base_gear_storage": 1, "cartridges": [ { "name": "php-5.3", "display_name": "PHP 5.3", "tags": [ "service", "php", "web_framework" ] }, { "name": "haproxy-1.4", "display_name": "OpenShift Web Balancer", "tags": [ "web_proxy", "scales", "embedded" ] } ], "gear_profile": "medium", "gears": [ { "id": "5213190e2587c8817a000121", "state": "idle", "ssh_url": "ssh://[email protected]", "port_interfaces": [ { "_id": "52168d8bdbd93c568d00006b", "cartridge_name": "php-5.3", "external_address": "75.101.235.82", "external_port": "57666", "internal_address": "127.9.159.129", "internal_port": "8080" } ] } ], "id": "5213190e2587c8817a00012c", "name": "5213190e2587c8817a00012c", "scales_from": 1, "scales_to": -1 }, { "additional_gear_storage": 0, "base_gear_storage": 1, "cartridges": [ { "connection_url": "mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/", "username": "adminxcYKabL", "password": "IgsS3_wQYF38", "database_name": "myapp",

154

Chapter 16. Gear Groups

"name": "mysql-5.1", "display_name": "MySQL Database 5.1", "tags": [ "service", "database", "embedded" ] } ], "gear_profile": "medium", "gears": [ { "id": "52131a1d2587c86695000520", "state": "started", "ssh_url": "ssh://52131a1d2587c86695000520@52131a1d2587c86695000520-mydomain.rhcloud.com", "port_interfaces": [ { "_id": "52168d8bdbd93c568d00006c", "cartridge_name": "mysql-5.1", "external_address": "75.101.235.82", "external_port": "50226", "internal_address": "127.6.183.129", "internal_port": "3306" } ] } ], "id": "52131a1d2587c86695000527", "name": "52131a1d2587c86695000527", "scales_from": 1, "scales_to": 1 } ], "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Showing gear groups for application 'myapp' with domain 'mydomain'" } ], "status": "ok", "type": "gear_groups", "version": "1.6" }

Report a bug

155

OpenShift Online All Versions REST API Guide

Supported SSH Keys


A.1. Types of SSH Keys Supported
T he table below lists all SSH key types that OpenShift currently supports. ssh-rsa ssh-dss [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 Go back to Chapter 6, SSH Keys Go back to Section 6.1, Add SSH Key Go back to Section 6.4, Update SSH Key Report a bug

156

Revision History

Revision History
Revision 1.0.36-0.4 05 Rebuild with Publican 4.0.0 T hu Nov 28 2013 Rdiger Landmann

Revision 1.0.36-0 T ue Nov 26 2013 Add information about deploying applications with artifact_url.

Bilhar Aulakh

Revision 1.0.35-0 T hu Nov 7 2013 Bilhar Aulakh Add Member API resource. Add Deployment API resource. Add information on specifying gear_size when creating an application or adding a cartridge. Revision 1.0.33-1 Fri Sep 20 2013 Add API resources to manage environment variables. Add API resource to tidy application framework. Add API resource to trigger thread dump. Updated all screen samples and references for API v1.6. Revision 1.0.31-0 T ue Aug 06 2013 Add Authorizations resource. Add Quickstarts resource. BZ 987665: Fix URL in cURL examples in Add SSH Key section. Revision 1.0.29-3 T hu Jun 13 2013 Publish book for OpenShift Online. Bilhar Aulakh

Bilhar Aulakh

Bilhar Aulakh

157

You might also like