1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:exsl="http://exslt.org/common" xmlns:ng="http://docbook.org/docbook-ng"><head>
5
<meta http-equiv="X-UA-Compatible" content="IE=7"/>
6
<title xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://docbook.org/ns/docbook">3.2. Request/Response Types - OpenStack Compute Developer Guide API 1.0
7
- API v1.0</title><meta xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://docbook.org/ns/docbook" name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><link rel="home" href="index.html" title="OpenStack Compute Developer Guide API 1.0"/><link rel="up" href="ch03.html" title="Chapter 3. General API Information"/><link rel="prev" href="ch03s01.html" title="3.1. Authentication"/><link rel="next" href="ch03s03.html" title="3.3. Content Compression"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script type="text/javascript">
8
//The id for tree cookie
9
var treeCookieId = "treeview-4704";
13
txt_filesfound = 'Results';
14
txt_enter_at_least_1_char = "You must enter at least one character.";
15
txt_browser_not_supported = "Your browser is not supported. Use of Mozilla Firefox is recommended.";
16
txt_please_wait = "Please wait. Search in progress...";
17
txt_results_for = "Results for: ";
18
</script><style type="text/css">
28
background: transparent url(../common/jquery/treeview/images/folder.gif) 0 0px no-repeat;
31
</style><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/><link rel="stylesheet" type="text/css" href="../common/css/positioning.css"/><link rel="stylesheet" type="text/css" href="../common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css"/><link rel="stylesheet" type="text/css" href="../common/jquery/treeview/jquery.treeview.css"/><script type="text/javascript" src="../common/jquery/jquery-1.4.2.min.js"><!----></script><script type="text/javascript" src="../common/jquery/jquery-ui-1.8.2.custom.min.js"><!----></script><script type="text/javascript" src="../common/jquery/jquery.cookie.js"><!----></script><script type="text/javascript" src="../common/jquery/treeview/jquery.treeview.min.js"><!----></script><script type="text/javascript" src="search/htmlFileList.js"><!----></script><script type="text/javascript" src="search/htmlFileInfoList.js"><!----></script><script type="text/javascript" src="search/nwSearchFnt.js"><!----></script><script type="text/javascript" src="search/stemmers/en_stemmer.js"><!--//make this scalable to other languages as well.--></script><script type="text/javascript" src="search/index-1.js"><!----></script><script type="text/javascript" src="search/index-2.js"><!----></script><script type="text/javascript" src="search/index-3.js"><!----></script></head><body><div xmlns="" id="header"><img src="../common/images/openstack-logo.png" alt="OpenStack Documentation" width="157" height="47"/><p class="breadcrumbs"><a href="http://docs.openstack.org/">OpenStack Manuals</a></p><h1>3.2. Request/Response Types</h1><div id="navheader" align="right"><!----><table class="navLinks"><tr><td><a id="showHideButton" onclick="showHideToc();" class="pointLeft" title="Hide TOC tree">Sidebar
32
</a></td><td><a accesskey="p" class="navLinkPrevious" href="ch03s01.html">Prev</a>
34
<a accesskey="u" class="navLinkUp" href="ch03.html">Up</a>
36
<a accesskey="n" class="navLinkNext" href="ch03s03.html">Next</a></td></tr></table></div></div><div id="content"><!----><div class="section" title="3.2. Request/Response Types"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="d1144e380"/>3.2. Request/Response Types</h2></div></div></div><p>
37
The Cloud Servers API supports both the JSON and XML
38
data serialization formats. The request format is
39
specified using the <code class="code">Content-Type</code> header
40
and is required for operations that have a request
41
body. The response format can be specified in
42
requests using either the <code class="code">Accept</code> header
43
or adding an .xml or .json extension to the request
44
URI. Note that it is possible for a response to be
45
serialized using a format different from the request
46
(see example below). If no response format is
47
specified, JSON is the default. If conflicting
48
formats are specified using both an
49
<code class="code">Accept</code> header and a query extension, the
50
query extension takes precedence.
51
</p><table rules="all" id="d1144e386"><caption>Table 3.1. JSON and XML Response Formats</caption><thead><tr>
53
<td>Accept Header</td>
54
<td>Query Extension</td>
56
</tr></thead><tbody><tr>
58
<td>application/json</td>
63
<td>application/xml</td>
66
</tr></tbody></table><div class="example"><a id="d1144e405"/><p class="title"><strong>Example 3.3. Request with Headers: JSON</strong></p><div class="example-contents"><pre class="literallayout">
67
POST /v1.0/214412/images HTTP/1.1
68
Host: servers.api.rackspacecloud.com
69
Content-Type: application/json
70
Accept: application/xml
71
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
72
</pre><pre class="programlisting">
76
"name" : "Just in case"}
78
</pre></div></div><br class="example-break"/><div class="example"><a id="d1144e409"/><p class="title"><strong>Example 3.4. Response with Headers: XML</strong></p><div class="example-contents"><pre class="literallayout">
80
Date: Mon, 12 Nov 2007 15:55:01 GMT
83
</pre><pre class="programlisting">
84
Content-Type: application/xml; charset=UTF-8
85
<image xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"
86
id="22" name="Just in case" serverId="12"
87
created="2010-10-10T12:00:00Z"
88
status="SAVING" progress="0" />
89
</pre></div></div><br class="example-break"/><p>
90
Notice, in the above example, that the content type is
91
set to application/json but application/xml is
92
requested via the <code class="code">Accept</code> header. An alternative
93
method of achieving the same result is illustrated
94
below – this time we utilize a URI extension instead
95
of an <code class="code">Accept</code> header.
96
</p><div class="example"><a id="d1144e416"/><p class="title"><strong>Example 3.5. Request with Extension: JSON</strong></p><div class="example-contents"><pre class="literallayout">
97
POST /v1.0/214412/images .xml HTTP/1.1
98
Host: servers.api.rackspacecloud.com
99
Content-Type: application/json
100
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
101
</pre><pre class="programlisting">
105
"name" : "Just in case"}
107
</pre></div></div><br class="example-break"/></div><script xmlns="" type="text/javascript" src="../common/main.js"><!----></script><hr xmlns=""/><h2 xmlns="" class="userNotes">User Notes On This Page</h2><div xmlns="" id="disqus_thread"><script type="text/javascript">
108
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
109
var disqus_shortname = 'openstackdocs';
117
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
118
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
119
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
121
</script><noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript><a href="http://disqus.com" class="dsq-brlink">User notes powered by <span class="logo-disqus">Disqus</span></a></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s01.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></div><div xmlns=""><div id="leftnavigation" style="padding-top:3px; background-color:white;"><div id="tabs"><ul><li><a href="#treeDiv"><span class="contentsTab">Contents</span></a></li><li><a href="#searchDiv"><span class="searchTab">Search</span></a></li></ul><div id="treeDiv"><img src="../../../common/images/loading.gif" alt="loading table of contents..." id="tocLoading" style="display:block;"/><div id="ulTreeDiv" style="display:none"><ul id="tree" class="filetree"><li xmlns="http://www.w3.org/1999/xhtml"><span class="file"><a href="ch01.html">1. Overview</a></span><ul><li><span class="file"><a href="ch01s01.html">1.1. Intended Audience</a></span></li><li><span class="file"><a href="ch01s02.html">1.2. Document Change History</a></span></li><li><span class="file"><a href="additional-resources.html">1.3. Additional Resources</a></span></li></ul></li><li xmlns="http://www.w3.org/1999/xhtml"><span class="file"><a href="ch02.html">2. Concepts</a></span><ul><li><span class="file"><a href="ch02s01.html">2.1. Server</a></span></li><li><span class="file"><a href="ch02s02.html">2.2. Flavor</a></span></li><li><span class="file"><a href="ch02s03.html">2.3. Image</a></span></li><li><span class="file"><a href="ch02s04.html">2.4. Backup Schedule</a></span></li><li><span class="file"><a href="ch02s05.html">2.5. Reboot</a></span></li><li><span class="file"><a href="ch02s06.html">2.6. Rebuild</a></span></li><li><span class="file"><a href="ch02s07.html">2.7. Resize</a></span></li><li><span class="file"><a href="ch02s08.html">2.8. Shared IP Address</a></span></li><li><span class="file"><a href="ch02s09.html">2.9. Shared IP Group</a></span></li></ul></li><li xmlns="http://www.w3.org/1999/xhtml"><span class="file"><a href="ch03.html">3. General API Information</a></span><ul><li><span class="file"><a href="ch03s01.html">3.1. Authentication</a></span><ul><li><span class="file"><a href="ch03s01.html#d1144e342">3.1.1. Request</a></span></li><li><span class="file"><a href="ch03s01.html#d1144e357">3.1.2. Response</a></span></li></ul></li><li id="webhelp-currentid"><span class="file"><a href="ch03s02.html">3.2. Request/Response Types</a></span></li><li><span class="file"><a href="ch03s03.html">3.3. Content Compression</a></span></li><li><span class="file"><a href="ch03s04.html">3.4. Persistent Connections</a></span></li><li><span class="file"><a href="ch03s05.html">3.5. Paginated Collections</a></span></li><li><span class="file"><a href="ch03s06.html">3.6. Caching</a></span></li><li><span class="file"><a href="ch03s07.html">3.7. Efficient Polling with the
122
Changes-Since Parameter</a></span></li><li><span class="file"><a href="ch03s08.html">3.8. Limits</a></span><ul><li><span class="file"><a href="ch03s08s01.html">3.8.1. Rate Limits</a></span></li><li><span class="file"><a href="ch03s08s02.html">3.8.2. Absolute Limits</a></span></li><li><span class="file"><a href="ch03s08s03.html">3.8.3. Determining Limits Programmatically</a></span></li></ul></li><li><span class="file"><a href="ch03s09.html">3.9. API Version</a></span></li><li><span class="file"><a href="ch03s10.html">3.10. Faults</a></span></li></ul></li><li xmlns="http://www.w3.org/1999/xhtml"><span class="file"><a href="ch04.html">4. API Operations</a></span><ul><li><span class="file"><a href="ch04s01.html">4.1. Servers</a></span><ul><li><span class="file"><a href="ch04s01s01.html">4.1.1. List Servers</a></span></li><li><span class="file"><a href="ch04s01s02.html">4.1.2. Create Server</a></span></li><li><span class="file"><a href="ch04s01s03.html">4.1.3. Get Server Details</a></span></li><li><span class="file"><a href="ch04s01s04.html">4.1.4. Update Server Name / Administrative Password</a></span></li><li><span class="file"><a href="ch04s01s05.html">4.1.5. Delete Server</a></span></li></ul></li><li><span class="file"><a href="ch04s02.html">4.2. Server Addresses</a></span><ul><li><span class="file"><a href="ch04s02s01.html">4.2.1. List Addresses</a></span></li><li><span class="file"><a href="ch04s02s02.html">4.2.2. List Public Addresses</a></span></li><li><span class="file"><a href="ch04s02s03.html">4.2.3. List Private Addresses</a></span></li><li><span class="file"><a href="ch04s02s04.html">4.2.4. Share an IP Address</a></span></li><li><span class="file"><a href="ch04s02s05.html">4.2.5. Unshare an IP Address</a></span></li></ul></li><li><span class="file"><a href="ch04s03.html">4.3. Server Actions</a></span><ul><li><span class="file"><a href="ch04s03s01.html">4.3.1. Reboot Server</a></span></li><li><span class="file"><a href="ch04s03s02.html">4.3.2. Rebuild Server</a></span></li><li><span class="file"><a href="ch04s03s03.html">4.3.3. Resize Server</a></span></li><li><span class="file"><a href="ch04s03s04.html">4.3.4. Confirm Resized Server</a></span></li><li><span class="file"><a href="ch04s03s05.html">4.3.5. Revert Resized Server</a></span></li></ul></li><li><span class="file"><a href="ch04s04.html">4.4. Flavors</a></span><ul><li><span class="file"><a href="ch04s04s01.html">4.4.1. List Flavors</a></span></li><li><span class="file"><a href="ch04s04s02.html">4.4.2. Get Flavor Details</a></span></li></ul></li><li><span class="file"><a href="ch04s05.html">4.5. Images</a></span><ul><li><span class="file"><a href="ch04s05s01.html">4.5.1. List Images</a></span></li><li><span class="file"><a href="ch04s05s02.html">4.5.2. Create Image</a></span></li><li><span class="file"><a href="ch04s05s03.html">4.5.3. Get Image Details</a></span></li><li><span class="file"><a href="ch04s05s04.html">4.5.4. Delete Image</a></span></li></ul></li><li><span class="file"><a href="ch04s06.html">4.6. Backup Schedules</a></span><ul><li><span class="file"><a href="ch04s06s01.html">4.6.1. List Backup Schedules</a></span></li><li><span class="file"><a href="ch04s06s02.html">4.6.2. Create / Update Backup Schedule</a></span></li><li><span class="file"><a href="ch04s06s03.html">4.6.3. Disable Backup Schedule</a></span></li></ul></li><li><span class="file"><a href="ch04s07.html">4.7. Shared IP Groups</a></span><ul><li><span class="file"><a href="ch04s07s01.html">4.7.1. List Shared IP Groups</a></span></li><li><span class="file"><a href="ch04s07s02.html">4.7.2. Create Shared IP Group</a></span></li><li><span class="file"><a href="ch04s07s03.html">4.7.3. Get Shared IP Group Details</a></span></li><li><span class="file"><a href="ch04s07s04.html">4.7.4. Delete Shared IP Group</a></span></li></ul></li></ul></li></ul></div></div><div id="searchDiv"><div id="search"><form onsubmit="Verifie(ditaSearch_Form);return false" name="ditaSearch_Form" class="searchForm"><fieldset class="searchFieldSet"><legend>Search</legend><center><input id="textToSearch" name="textToSearch" type="text" class="searchText"/> <input onclick="Verifie(ditaSearch_Form)" type="button" class="searchButton" value="Go" id="doSearch"/></center></fieldset></form></div><div id="searchResults"><center/></div><p class="searchHighlight"><a href="#" onclick="toggleHighlight()">Search Highlighter (On/Off)</a></p></div></div></div></div></body></html>
b'\\ No newline at end of file'