Topic: API and Deleting Records

I noticed you wrote this here (http://consolibyte.com/forum/viewtopic.php?pid=729#p729):

consolibyte wrote:

Sorry, I don't right now. But, if you find something you're missing, let me know what it is and I can usually add it pretty easily. Or, if you post up what you need, I can tell you if it's available. As a general overview, what's supported right now is something along the lines of:

Add/Update/Get- Invoices, Customers, Purchase Orders, Vendors, Items, Accounts, Sales Receipts, Classes, Units of Measure, Bills.

The major limitation is it doesn't support iterators, so if you need to pull a large # of records out of QuickBooks the QuickBooks_API classes can be difficult to use.

Is there any way to add Delete? I am more than willing to help if you can get me started. I write super clean OO PHP (and i prefer my brackets on a new line as well wink ) I am working on a project that uses your SQL sync read-only to retrieve records and the API for updating. Seems to be going well so far (also no need for iteration when i can SQL limit and offset), but no delete. So I figure if it's not there, I'll make it myself and share. OR If you'd be willing just to add "delete customer" i may be able to fill in the others. Let me know man!

Re: API and Deleting Records

Hi Jeremy,

It's definitely possible to add support for deletes without too much effort. If you want to add it yourself, shoot me an email or an instant message and I can get you started on things.

If you're familiar with Subversion, it would be best if you joined code.intuit.com and then request to join the PHP DevKit project (https://code.intuit.com/sf/projects/php_devkit) so that I can grant you subversion commit access.

Re: API and Deleting Records

I joined up and sent a request to the group. I PMed you as well.

Re: API and Deleting Records

So I was adding in some stuff like the QBXML/Schema/Object/ListDelRq.php and the _doDel and deleteCustomer method... I ended up with producing some nice QBXML outputs like this:

<?xml version="1.0" encoding="utf-8"?>
            <?qbxml version="8.0"?>
            <QBXML>
                <QBXMLMsgsRq onError="stopOnError">
<ListDelRq>
    <ListDelType>Customer</ListDelType>
    <ListID>80000005-1279075015</ListID>
</ListDelRq>
                 </QBXMLMsgsRq>
            </QBXML>

Even though this validates just fine i keep getting this error:

-2: No registered functions for action: ListDel

What am I doing wrong here?

Re: API and Deleting Records

QuickBooks Online Edition, or some desktop version of QuickBooks?

Re: API and Deleting Records

Well the test server is running the free Simple Start Deluxe version of 2010, but it validates clean in both.

Re: API and Deleting Records

Callbacks will have to be added to QuickBooks/Callbacks/API/Callbacks.php named ListDelRequest() and ListDelResponse().

Re: API and Deleting Records

That did the trick!

Here is my review:

1. I got $API_client->deleteCustomer() working, using a _doDel that i slightly modified from _doMod.

2. I added the QuickBooks/QBXML/Schema/Object/ListDelRq.php file.

3. And I added callbacks here:

consolibyte wrote:

QuickBooks/Callbacks/API/Callbacks.php named ListDelRequest() and ListDelResponse().

I will do some more testing before I commit my changes and let you take a look and clean it up if you like (i'm sure you know how your framework runs best, I've just scratched the surface so far). Thanks again for all your help!

Re: API and Deleting Records

Sounds good to me. Some of the API stuff is a bit crufty, so feel free to clean up if you see things that are a bit nasty.

Let me know what else I can do to help.