Notes API How to Retrieve Notes with NULL User Id

Hello,

I was having trouble with the API retrieving all of the notes for our company in one call so I redesigned the process to get notes by User_Id as that is one of the few query parameters that I see and it appeared to work with the exception of the records with a NULL User_Id. How can I retrieve those records?

Are there any other parameter that I can use? I didn’t see a since date. There is also contact_id but there is the same issue with that.

Thank you

We need to get it added to the v2 docs, but you can use assigned_to_user_id==UNASSIGNED as a filter to get the Notes that are not assigned to any user, but since every note is attached to a particular Contact you will probably have the reverse problem going forward. We do not have a Note object that is not attached to a Contact in Keap, so if what you are actually looking for is just some kind of general-purpose object storage you’ll likely need to store those in some external repository.

Thank you so much Tom for providing me with that example, I always wondered how to use the filter option, this is great. However, you are right about the future. I don’t know what contacts have notes that are not assigned before hand so this won’t help me. If I could use this without the contact_id it would be helpful.

I also think I found a bug with this V2 API, it returns last_updated_by_user_id = 0 for all records where as the V1 returns the correct value.

For now I am trying to loop through every contact_id which I am not sure is feasible.

Hi Andrea,

I recommend that you use the XML-RPC API functions to query the Notes table instead.
The REST API is limiting in places and is not as flexible as the XML-RPC API.

You need to query the “ContactAction” table in which it holds the Notes.
The “ObjectType” field needs to be queried under the value of “Note”.
https://developer.infusionsoft.com/docs/table-schema/#ContactAction

You will need to use the Data Query API function.
https://developer.keap.com/docs/xml-rpc/#data-query-a-data-table

Checking the results of the table, you will need to search on “UserId” value “0” for non-assigned users.

Hope that helps.

Thank you so much for the insight Pav! I have been very curious about the XLM-RPC API and thought it might be the solution a few times but I don’t know how to use/call it. Right now I am using the REST APIs through Azure Data Factory. I am more of an analytics/database person and not really a developer. Can I call this API via Data Factory? Is there someone I could potentially work with to get me started on this?

I know Keap’s PHP SDK has support for the Data Service, but as you are using the Azure platform you need something different here.

I am not an Azure expert, but I know Microsoft has an Infusionsoft Connector, are you using this below.
Although from what I am seeing it has very limited functionality.

I extracted a piece of code I wrote last year which is bare minimum in updating the Contact Record via XML-RPC. I am not sure if you have something in Azure that can deal with this. You would have to alter the XML to fit your needs, but the API Documentation will explain this. It also works with the Legacy API Encrypted Key and not OAuth Tokens.

If that does not help, then you will have to contact an expert in the Marketplace to see if they can help you here, but it may come at a price. https://marketplace.keap.com/

<?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 = "**ABCDEF**";    // Your Keap Account Name.
    $key = "**ABCDEF**";    // Your API Encrypted Key.

    // Contact Details To Update.
    $contact = 123;                  // Contact Id.
    $field   = "JobTitle";           // Contact Field to update.
    $value   = date("Y-m-d H:i:s");  // Contact Value to set.

    // API Request.
    $request = "<?xml version='1.0' encoding='UTF-8'?>
        <methodCall>
            <methodName>ContactService.update</methodName>
            <params>
                <param>
                    <value><string>$key</string></value>
                </param>
                <param>
                    <value><int>$contact</int></value>
                </param>
                <param>
                    <value>
                        <struct>
                            <member>
                                <name>$field</name>
                                <value>
                                    <string>$value</string>
                                </value>
                            </member>                
                        </struct>
                    </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_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, 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);

    var_dump($output);```