Fetch list of note types via API

Here is an example PHP XML-RPC API Script that uses the Legacy API Key to get the Note Types.

The “$app” and “$key” variables would need to be set to your Application Account Name (Subdomain) and the API Key (Legacy, not OAuth).

When dealing with the raw XML-RPC, then it would be better to use the SDK to make it easier for yourself.

<?php

    // Example PHP script to update the Contact Job Title field via the XML-RPC using the Legacy API Encrypted Key.

    ini_set("display_errors", 1);
    ini_set("display_startup_errors", 1);
    error_reporting(E_ALL);

    // API Connection.
    $app = "XXX";    // Your Keap Account Name.
    $key = "XXX";    // Your API Encrypted Key.

    // API Request.
    $request = "<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>DataService.getAppSetting</methodName>
  <params>
    <param>
      <value><string>{$key}</string></value>
    </param>
    <param>
      <value><string>ContactAction</string></value>
    </param>
    <param>
      <value><string>optionstype</string></value>
    </param>    
  </params>
</methodCall>";

    $url       = "https://{$app}.infusionsoft.com:443/api/xmlrpc";
    $headers   = [ "Content-Type: text/xml", "Accept-Charset: UTF-8,ISO-8859-1,US-ASCII", "Expect:" ];
    $useragent = "XML-RPC Example";

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_ENCODING, "");
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_SSLVERSION, 0);

    $output = curl_exec($ch);

    curl_close($ch);

    list($headers, $content) = explode("\r\n\r\n", $output, 2);

  //  print_r($output);

    $xml = new SimpleXMLElement($content); 

    echo $xml->params->param->value;

Hope that helps.