Blair Connolly
Blair Connolly

Reputation: 604

QuickBooks API request returning "Premature end of file", error code -2001

I am making calls to the QuickBooks API, I have many other queries that are working correctly so I am confident that it is not something with my OAuth library or any of the basic framework. But this is my first attempt to do a filter query, so it is probably something specific to this type of query. I am making a POST request to https://services.intuit.com/sb/customer/v2/realmid (yes, using my real realm id), with the following xml as the body of the request:

<?xml version="1.0" encoding="UTF-8"?>
<CustomerQuery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.intuit.com/sb/cdm/v2">
<FirstLastInside>bla</FirstLastInside>
</CustomerQuery>

This is the response that I get:

<?xml version="1.0" ?>
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Error RequestId="3f7113681b0749fc97644b6c4486985f">
<RequestName>ErrorRequest</RequestName>
<ProcessedTime>2013-07-01T16:08:40.230Z</ProcessedTime>
<ErrorCode>-2001</ErrorCode>
<ErrorDesc>Premature end of file.</ErrorDesc>
</Error>
</RestResponse>

Any ideas, anyone?

Upvotes: 3

Views: 465

Answers (2)

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

Can you please try this call using ApiExplorer tool(QBD).

Link - https://developer.intuit.com/apiexplorer?apiname=V2QBD

PFB snapshot

enter image description here

Please let me know if it works for you.

EDIT Adding endpoint and post body. It worked fine

Endpoint - https://services.intuit.com/sb/customer/v2/<relam-id>
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CustomerQuery xmlns="http://www.intuit.com/sb/cdm/v2">
    <FirstLastInside>Manas</FirstLastInside>
</CustomerQuery>

Upvotes: 1

Developer
Developer

Reputation: 362

The correct URL is https://services.intuit.com/sb/customer/v2/{realmid}. So @Blair you did have the correct URL. The error is a valid error being returned by intuit servers.

The API explorer is there to try out your credentials and tokens. You can use those tokens in your oauth library and compare to make sure your post is similar to what is being posted in the api explorer. Obviously the oauth header itself that is generated will not match but that is ok.

The idea is to compare what you are posting in your header and payload with what apiexplorer is doing to give you better insight into the problem. Please try that and let us know if it solved the issue.

Upvotes: 3

Related Questions