Happy Business Starts Here

Support SME

Handling AQuA syntax errors (ZOQL vs ZOQLEXPORT)

Question:

 

Why am I getting a "There is a syntax error in one of the queries in the AQuA input" error message when I am using the same query I use for the corresponding SOAP call, e.g. select BillToId from Account?

 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

3 REPLIES 3
Support SME

Re: Handling AQuA syntax errors (ZOQL vs ZOQLEXPORT)

Answer:

 

AQuA can process "zoql" and "zoqlexport" type calls. When you select zoql, you can simply use the same format what you'd use for a SOAP call, so our query above would look like this:

 

{
"format" : "csv",
"version" : "1.1",
"name" : "Example2",
"encrypted" : "none",
"useQueryLabels" : "true",
"partner" : "viktortest",
"project" : "testsession1",
"dateTimeUtc" : "true",
"queries"  : [ {
    "name" : "Account",
    "query" : "select billtoid from account",
    "type" : "zoql"
  }]
}

However if we'd set type to zoqlexport, then we'd need to use the same format as would be used for a create() export call, as in this case we're not querying via the API framework, but we're creating exports using the Data Source Export framework.

 

There are differences between how API objects and Data Sources are handled. For the SOAP API object, BillToId is actually a field under the Account object. But in case of Data Sources, BillToContact is a separate Data Source from Account, and is pre-joined with it, therefore the correct zoqlexport query to fetch the BillToContact ID would be the following:

 

{
"format" : "csv",
"version" : "1.1",
"name" : "Example2",
"encrypted" : "none",
"useQueryLabels" : "true",
"partner" : "viktortest",
"project" : "testsession1",
"dateTimeUtc" : "true",
"queries"  : [ {
    "name" : "Account",
    "query" : "select billtocontact.id from account",
    "type" : "zoqlexport"
  }]
}

 

Supporting reference:

https://knowledgecenter.zuora.com/DC_Developers/T_Aggregate_Query_API/B_Submit_Query

https://knowledgecenter.zuora.com/DC_Developers/M_Export_ZOQL

https://knowledgecenter.zuora.com/DC_Developers/K_Zuora_Object_Query_Language

http://knowledgecenter.zuora.com/DC_Developers/G_SOAP_API/E1_SOAP_API_Object_Reference/Export/Create...



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Honor Student

Re: Handling AQuA syntax errors (ZOQL vs ZOQLEXPORT)


@Viktor wrote:

When you select zoql, you can simply use the same format what you'd use for a SOAP call, so our query above would look like this (and you will receive your results synchronously in a response) ...


 

Can you please explain what you mean by "you will receive your results synchronously in a response"?

 

Whether I submit a "zoql" or "zoqlexport" query type, I seem to get the same basic response back from the AQuA API.  This includes a pointer (id) to the report that was created, which I then have to go and download as a separate process.

 

Support SME

Re: Handling AQuA syntax errors (ZOQL vs ZOQLEXPORT)

Thanks for pointing this out @benjohnson , I've revisited this and while using ZOQL you do get the same response you would get by triggering a synchronous query, in AQuA's case it will indeed end up in an extract file, and the response will just point to that file. I'll edit my comment in a bit. (edit is now done)

 

If you need a synchronous response, REST remains the suggested solution.



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √