sag sag - 1 year ago 224
reST (reStructuredText) Question

ZOQL Execution via Zuora REST API

I am trying to execute some ZOQL via Zuora REST API.

I've referred this doc and I am using REST endpoint v1/action/query to execute ZOQL.

First I tried with very simple request and got the result back

"queryString": "select AccountId, FirstName, LastName from contact"

Now I tried query with asterisk like below

"queryString": "select * from contact"

But I got below error

"faultcode": "fns:MALFORMED_QUERY",
"faultstring": "You have an error in your ZOQL syntax",
"detail": {
"MalformedQueryFault": {
"FaultMessage": "You have an error in your ZOQL syntax"

From here, I found that ZOQL supports asterisk. I even got the same error for ZOQL which involves multiple objects. Like

SELECT Subscription.Name, Account.Name FROM Subscription WHERE Subscription.Status='Active' AND DefaultPaymentMethod.CreditCardType='Visa'

Above query does not work in Zuora SOAP API as well

How can I execute query with asterisk in Zuora REST API or in Zuora SOAP API?

Answer Source

Queries With Asterix In ZOQL:

In short: You just can't use asterix.

More info:

From Zuora KnowledgeCenter:

No Wild Card Support

You cannot use the asterisk wild card (*) for field names with a query() call. You must explicitly specify a field name.

The above source you mentioned stating that you can use asterix, is NOT about ZOQL, but about Export ZOQL.

Export ZOQL is different from ZOQ, as stated in the docs above:

Zuora Export ZOQL (Zuora Object Query Language) is the query language used to create Exports with the Export object in the Zuora SOAP API. Zuora Export ZOQL is similar to our general ZOQL, with a few differences. The biggest difference is that with Exports, you query a Zuora data source, not a SOAP API object.

Hope this helps you.

Good luck!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download