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.
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.
<?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param> <value> <key>482</key> </value> </param> </params> </methodResponse>
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:
Reurn: (int) The Id number of contact updated<?xml version='1.0' encoding='UTF-8'?> <methodResponse> <params> <param> <value> <i4> contactIDNumber </i4> </value> </param> </params> </methodResponse>
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>.
<?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>