-->

Receiving a SystemFault when I query Item

2019-07-01 17:04发布

问题:

Using V3 when I attempt to query for Items I receive a generic error with a SystemFault type.

I am attempting to perform Select * From Item Where Name = 'Something'

This does work in the API Explorer, and I believe I am re-creating the HTTP request accurately.

My HTTP GET is:

GET /v3/company/redacted/query?query=Select%20*%20From%20Item%20Where%20Name%20=%20'Something'%20STARTPOSITION%201%20MAXRESULTS%2020 HTTP/1.1
Accept  application/xml
Accept-Encoding gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Authorization   OAuth oauth_consumer_key="redacted", oauth_nonce="redacted", oauth_signature="redacted", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1386704546", oauth_token="redacted", oauth_version="1.0"
Host    qb.sbfinance.intuit.com

And the response I am receiving:

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-10T11:42:03.147-08:00">
    <Fault type="SystemFault">
        <Error code="10000">
            <Message>An application error has occurred while processing your request</Message>
            <Detail>System Failure Error: Unexpected Internal Error. (-30000)</Detail>
        </Error>
    </Fault>
</IntuitResponse>

Am I missing something obvious? Thank you.

回答1:

It's not obvious, but from the documentation found here, it looks like you must encode the ' and = present on your query.

So instead of:

/v3/company/redacted/query?query=Select%20*%20From%20Item%20Where%20Name%20=%20'Something'%20STARTPOSITION%201%20MAXRESULTS%2020

You should use

/v3/company/redacted/query?query=Select%20*%20From%20Item%20Where%20Name%20%3D%20%27Something%27%20STARTPOSITION%201%20MAXRESULTS%2020

Encoding ' to %27, and = to %3D.