-
Notifications
You must be signed in to change notification settings - Fork 15
/
response.html
131 lines (131 loc) · 5.57 KB
/
response.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html>
<head>
<title>Responses</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-extension.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<link href="google-code-prettify/src/prettify.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="google-code-prettify/src/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<div class="container">
<img src="bootstrap/img/logo.png"><hr>
<div class="row">
<div class="span3 sidebar">
<div class="well" style="padding: 8px 0;">
<ul class="nav nav-list">
<li class="nav-header">Overview</li>
<li><a href="index.html">Introduction</a></li>
<li><a href="request.html">Requests</a></li>
<li class="active"><a href="response.html">Responses</a></li>
<li><a href="error.html">Errors</a></li>
<li><a href="api_console.html">API Console</a></li>
<li><a href="rate_limiting.html">API Rate Limiting</a></li>
<li><a href="changelog.html">Changelog</a></li>
<li class="nav-header">Services</li>
<li><a href="affiliateservice.html">AffiliateService</a></li>
<li><a href="contactservice.html">ContactService</a></li>
<li><a href="dataservice.html">DataService</a></li>
<li><a href="discountservice.html">DiscountService</a></li>
<li><a href="emailservice.html">EmailService</a></li>
<li><a href="fileservice.html">FileService</a></li>
<li><a href="invoiceservice.html">InvoiceService</a></li>
<li><a href="orderservice.html">OrderService</a></li>
<li><a href="productservice.html">ProductService</a></li>
<li><a href="searchservice.html">SearchService</a></li>
<li><a href="shippingservice.html">ShippingService</a></li>
<li><a href="webformservice.html">WebFormService</a></li>
</ul>
</div>
</div>
<div class="span9">
<h1>Responses Overview</h1>
<p>Infusionsoft will reply to your API requests with XML returned as a string to your HTTP requests. If using an XML-RPC library, it should take care of parsing the returned XML for you. If not, you will need to parse the response yourself. It would be worth your while to investigate whether or not functionality already exists for handling XML-RPC in your language of choice.</p>
<h3>Response Format</h3>
<p>Different methods return different data types in the XML structured in different ways - it is important to note what the response format for a given method is in order to avoid errors when parsing a response.</p>
<pre class="prettyprint">
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<key>482</key>
</value>
</param>
</params>
</methodResponse>
</pre>
<h3>Single Parameter Responses</h3>
<p>Methods that return single responses such as a Boolean or an integer do so within a single parameter of the response. Here's a successful response from a method that returns a value:</p>
<span>Reurn: (int) The Id number of contact updated</span>
<pre class="prettyprint">
<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
<params>
<param>
<value>
<i4>
contactIDNumber
</i4>
</value>
</param>
</params>
</methodResponse>
</pre>
<h3>Multi Parameter Responses</h3>
<p>When receiving multi parameter responses, you'll need to parse the struct. Here is the response from findByEmail. You'll need to parse the "Name/Value" out of the <struct>. If it returns more than one set of data, it will be in multiple <structs>.</p>
<pre class="prettyprint">
<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
<params>
<param>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>FirstName</name>
<value>John</value>
</member>
<member>
<name>Id</name>
<value><i4>16</i4></value>
</member>
<member>
<name>LastName</name>
<value>Doe</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>FirstName</name>
<value>Ron </value>
</member>
<member>
<name>Id </name>
<value><i4>18</i4>
</value>
</member>
<member>
<name>LastName</name>
<value>Doe</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</param>
</params>
</methodResponse>
</pre>
</div>
</div>
</div>
</body>
</html>