mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-03 04:12:31 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			59 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version='1.0' encoding='utf-8' ?>
 | 
						|
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 | 
						|
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
 | 
						|
%BOOK_ENTITIES;
 | 
						|
]>
 | 
						|
 | 
						|
<!-- Licensed to the Apache Software Foundation (ASF) under one
 | 
						|
 or more contributor license agreements.  See the NOTICE file
 | 
						|
 distributed with this work for additional information
 | 
						|
 regarding copyright ownership.  The ASF licenses this file
 | 
						|
 to you under the Apache License, Version 2.0 (the
 | 
						|
 "License"); you may not use this file except in compliance
 | 
						|
 with the License.  You may obtain a copy of the License at
 | 
						|
 
 | 
						|
   http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
 
 | 
						|
 Unless required by applicable law or agreed to in writing,
 | 
						|
 software distributed under the License is distributed on an
 | 
						|
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 | 
						|
 KIND, either express or implied.  See the License for the
 | 
						|
 specific language governing permissions and limitations
 | 
						|
 under the License.
 | 
						|
-->
 | 
						|
 | 
						|
<section id="response-formats">
 | 
						|
    <title>Response Formats: XML and JSON</title>
 | 
						|
    <para>CloudStack supports two formats as the response to an API call. The default response is XML. If you would like the response to be in JSON, add &response=json to the Command String.</para>
 | 
						|
    <para>The two response formats differ in how they handle blank fields. In JSON, if there is no value for a response field, it will not appear in the response. If all the fields were empty, there might be no response at all.
 | 
						|
      In XML, even if there is no value to be returned, an empty field will be returned as a placeholder XML element.</para>
 | 
						|
    <para>Sample XML Response:</para>
 | 
						|
    <programlisting>
 | 
						|
     <listipaddressesresponse> 
 | 
						|
        <allocatedipaddress>
 | 
						|
        <ipaddress>192.168.10.141</ipaddress> 
 | 
						|
        <allocated>2009-09-18T13:16:10-0700</allocated> 
 | 
						|
        <zoneid>4</zoneid> 
 | 
						|
            <zonename>WC</zonename> 
 | 
						|
            <issourcenat>true</issourcenat> 
 | 
						|
        </allocatedipaddress>
 | 
						|
     </listipaddressesresponse>
 | 
						|
    </programlisting>
 | 
						|
    <para>Sample JSON Response:</para>
 | 
						|
    <programlisting>
 | 
						|
        { "listipaddressesresponse" : 
 | 
						|
          { "allocatedipaddress" :
 | 
						|
            [ 
 | 
						|
              { 
 | 
						|
                "ipaddress" : "192.168.10.141", 
 | 
						|
                "allocated" : "2009-09-18T13:16:10-0700",
 | 
						|
                "zoneid" : "4", 
 | 
						|
                "zonename" : "WC", 
 | 
						|
                "issourcenat" : "true" 
 | 
						|
              } 
 | 
						|
            ]
 | 
						|
          } 
 | 
						|
        } 
 | 
						|
    </programlisting>
 | 
						|
</section>
 |