OpenShift Online All Versions REST API Guide Using the OpenShift Online Representational State Transfer Application Programming Interface (REST API) PressGang CCMS Build System OpenShift Online All Versions REST API Guide Using the OpenShift Online Representational State Transfer Application Programming Interface (REST API) PressGang CCMS Build System Red Hat Engineering Content Services Legal Notice 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. 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 Torvalds 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. Keywords Abstract A guide to using the OpenShift Online REST API for developers Table of Contents Table of Contents .P . r.e . f.a . c. e. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Document Conventions 4 1.1. Typographic Conventions 4 1.2. Pull-quote Conventions 5 1.3. Notes and Warnings 6 2. Getting Help 6 2.1. Do You Need Help? 6 2.2. We Need Feedback! 7 .C . h. a. .p . t.e . r. .1 .. . I.n .t .r .o .d . u. c. .t i. o. n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1. About OpenShift API 8 1.2. About Representational State Transfer (REST) 8 .C . h. a. .p . t.e . r. .2 .. . G. .e . n. e. .r a. .l .A . P. .I .I n. .f o. .r .m . a. .t i. o. n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1. Authentication 9 2.2. Version 9 2.3. Response Type 11 2.4. Link Navigation 12 2.5. OpenShift API Status Codes 16 .C . h. a. .p . t.e . r. .3 .. .A . P. .I .E . n. .t r. y. . P. o. .i n. .t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 .C . h. a. .p . t.e . r. .4 . .. A. .u .t .h . o. r. i.z .a . t. i.o .n . s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1. List Authorizations 23 4.2. Add an Authorization 24 4.3. Show Authorization 26 4.4. Get Authorization Information 28 4.5. Update an Authorization 29 4.6. Delete All Authorizations 30 4.7. Delete an Authorization 31 .C . h. a. .p . t.e . r. .5 .. . D. .o .m . .a .i n. .s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1. List Domains 33 5.2. Create a Domain 34 5.3. Get Domain Information 34 5.4. Update Domain Name 35 5.5. Delete a Domain 36 .C . h. a. .p . t.e . r. .6 .. . A. p. .p . l.i c. a. .t i. o. n. .s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.1. List Applications 38 6.2. List Applications and Cartridges 41 6.3. Check DNS Availability 45 6.4. Create an Application 46 6.5. Get Application Information 49 6.6. Get Application and Cartridge Information 50 6.7. Start Application 52 6.8. Stop Application 53 6.9. Force Stop Application 53 6.10. Restart Application 54 6.11. Delete Application 55 6.12. Scale Up Application 56 6.13. Scale Down Application 57 1 OpenShift Online All Versions REST API Guide .C . h. a. .p . t.e . r. .7 .. . A. p. .p . l.i c. a. .t i. o. n. . A. .l i.a . s. e. s. . a. n. .d . .S . S. L. . C. .e . r. t.i f. i.c .a . t. e. s. . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 7.1. List Application Aliases 59 7.2. Add Application Alias 60 7.3. Update Application Alias 61 7.4. Delete Application Alias 63 .C . h. a. .p . t.e . r. .8 .. . C. .a .r .t .r i. d. g. .e .s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.1. List Cartridges 66 8.2. Embedded Cartridges 68 8.2.1. List Embedded Cartridges 68 8.2.2. Add Cartridge 69 8.2.3. Get Cartridge Information 71 8.2.4. Get Cartridge Status 73 8.2.5. Get Gear Groups 73 8.2.6. Start Cartridge 76 8.2.7. Stop Cartridge 77 8.2.8. Restart Cartridge 78 8.2.9. Reload Cartridge 79 8.2.10. Update Cartridge Configuration 80 8.2.11. Delete Cartridge 82 .C . h. a. .p . t.e . r. .9 .. . Q. .u . i.c .k .s . t.a . r. t.s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 9.1. List Quickstarts 84 9.2. Show Quickstart 85 9.3. Search Quickstarts 87 .C . h. a. .p . t.e . r. .1 .0 . .. U. .s .e . r. .I n. f. o. r. m. . a. t. i.o . n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 10.1. View User Information 89 10.2. About Parent and Child Accounts 90 10.2.1. Delete Child Account 90 .C . h. a. .p . t.e . r. .1 .1 . .. S. .u . b. s. c. .r i. p. t. i.o . n. .P . l.a . n. s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 11.1. List Plans 92 11.2. Get Plan Information 95 11.3. Change Plan 97 .C . h. a. .p . t.e . r. .1 .2 . .. S. .S . H. . K. .e .y . s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 12.1. List User SSH Keys 99 12.2. Add SSH Key 100 12.3. Get SSH Key Information 101 12.4. Update SSH Key 102 12.5. Delete SSH Key 103 .S . u. p. .p .o . r. t.e . d. . S. S. .H . .K . e. .y .s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 A.1. Types of SSH Keys Supported 105 .R . e. v. i. s. i.o . n. .H . i.s . t.o . r. y. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 2 Table of Contents 3 OpenShift Online All Versions REST API Guide Preface 1. Document Conventions This 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. The Liberation Fonts set is also used in HTML 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 includes the Liberation Fonts set by default. 1.1. Typographic Conventions Four typographic conventions are used to call attention to specific words and phrases. These 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: To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command. The 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. The first example highlights a particular key to press. The 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 mono-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 This 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 sub-menu titles. For example: Choose System → Preferences → Mouse from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse 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). To insert a special character into a gedit file, choose Applications → Accessories → 4 Preface 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. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose Edit → Paste from the gedit menu bar. The 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: To connect to a remote machine using ssh, type ssh [email protected] at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh [email protected]. The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home. To 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 Terminal output and source code listings are set off visually from the surrounding text. Output sent to a terminal is set in mono-spaced roman and presented thus: books Desktop documentation drafts mss photos stuff svn books_tests Desktop1 downloads images notes scripts svgs Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows: 5 OpenShift Online All Versions REST API Guide 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 6
Description: