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": {
"FaultCode": "MALFORMED_QUERY",
"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'
EDIT
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?
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!
When you use a * in query it is because:
1) you want all the fields available
OR
2) you want to find out WHAT fields are available.
For the later case, use the Describe function of the REST service as in:
https://{servicename}.zuora.com:####/v1/describe/Invoice
which will return an XML description of the Invoice (or any other) object as:
<?xml version="1.0" encoding="UTF-8"?>
<object href="https://services470.zuora.com/apps/api/describe/Invoice">
<name>Invoice</name>
<label>Invoice</label>
<fields>
<field>
<name>AccountId</name>
<label>Account ID</label>
<selectable>true</selectable>
<createable>true</createable>
<updateable>false</updateable>
<filterable>true</filterable>
<custom>false</custom>
<maxlength></maxlength>
<required>true</required>
<type>text</type>
<contexts>
<context>soap</context>
</contexts>
</field>
<field>
<name>AdjustmentAmount</name>
<label>Adjustment Amount</label>
<selectable>true</selectable>
<createable>false</createable>
<updateable>false</updateable>
<filterable>true</filterable>
<custom>false</custom>
<maxlength></maxlength>
<required>true</required>
<type>decimal</type>
<contexts>
<context>soap</context>
<context>export</context>
</contexts>
</field>
<!-- All fields for Invoice...ETC -->
</fields>
</object>
Related
When making REST endpoint call to MarkLogic, is there an option to get only the data in the response without the additional metadata?
I am trying to use to make such connections using tools like Tableau, Qlik, Denodo etc
Options I use in the POST body on the URL: http://localhost:8000/v1/search
<search xmlns="http://marklogic.com/appservices/search">
<options>
<extract-document-data selected="all"></extract-document-data>
<transform-results apply="raw" />
</options>
</search>
Result I get:
<search:response snippet-format="raw" total="150" start="1" page-length="10" selected="all" xmlns:search="http://marklogic.com/appservices/search">
<search:result index="1" uri="/doc/21_doc.xml" path="fn:doc("/doc/21_doc.xml")" score="0" confidence="0" fitness="0" href="/v1/documents?uri=%2Fdoc%2F21_doc.xml" mimetype="application/xml" format="xml">
<root>
<col1>data1</col1>
<col2>data1</col2>
<col3>data1</col3>
</root>
<search:extracted kind="element">
<root>
<col1>data1</col1>
<col2>data1</col2>
<col3>data1</col3>
</root>
</search:extracted>
</search:result>
<search:metrics>
<search:query-resolution-time>PT0.0005236S</search:query-resolution-time>
<search:snippet-resolution-time>PT0.0001001S</search:snippet-resolution-time>
<search:extract-resolution-time>PT0.0003971S</search:extract-resolution-time>
<search:total-time>PT0.0021503S</search:total-time>
</search:metrics>
</search:response>
Expected:
<search:extracted kind="element">
<root>
<col1>data1</col1>
<col2>data1</col2>
<col3>data1</col3>
</root>
</search:extracted>
Also, why am I getting data in both extracted and result elements?
Both snippeting and data extraction provide access to content. Use either, or use them for different purposes. If you only like to get extracted data, then use:
<transform-results apply="empty-snippet" />
HTH!
If you want the original documents, specify an Accept header of multipart-mixed and specify only the content value for the a category URI parameter.
See: https://docs.marklogic.com/REST/POST/v1/search
and https://docs.marklogic.com/guide/rest-dev/bulk#id_65903
As an alternative, you may find it easier to provide rows to Business Intelligence Tools by creating TDE indexes and paging over an Optic query with the /v1/rows endpoint.
See: https://docs.marklogic.com/guide/rest-dev/search#id_34628
and https://docs.marklogic.com/REST/POST/v1/rows
Hoping that helps,
I am currently trying to work with the SuiteTalk 2017_2_0 API for a new integration with NetSuite. I have all the basics rolling of single record retrieval, etc.; however, I am having a problem trying to figure out how to list all of a given object/type in the system.
Example: I want to list ALL InventoryItem data.
Not sure what I am missing. Does anyone have a sample SOAP doc?
What I did so far
I have been working primarily with types: Sales Order, Customer and Inventory Item.
Tried using the getAll call defined in the WSDL - only supports limited fields:
budgetCategory
campaign*
currency
etc.
Tried using getList but a set of internal IDs are required in the baseRef/RecordRef (INVALID_KEY_OR_REF - The specified key is invalid.)
Fails:
<urn:getList>
<urn1:baseRef xsi:type="core:RecordRef" type="salesOrder" />
</urn:getList>
Succeeds:
<urn:getList>
<urn1:baseRef xsi:type="core:RecordRef" type="salesOrder" internalId="1" />
<urn1:baseRef xsi:type="core:RecordRef" type="salesOrder" internalId="2" />
</urn:getList>
Tried formulating a search that would return all the data but the types I need are unavailable (or I haven't been able to figure it out)
Define a saved search that pulls the appropriate data, then call the saved search.
I am trying to populate a property in a WSO2 proxy. I'am using the following syntax and xpath expression:
<property expression="//RelationValueList/PersonnelRelationValueUnitType[RelAttrId='R54' and DateTo=max(//RelationValueList/PersonnelRelationValueUnitType[RelAttrId='R54']/DateTo/xs:dateTime(.))][last()]/RelationValue" name="RelValue" scope="default" type="STRING"/>
This Xpath expression is working fine in an online Xpath tester. But when using it in WSO2 expression of a property mediator it gives me the following Eclipse error:
wso2 unknown synapse configuration tag
Error message
The XML document looks like this:
<GetPersonnelResponse>
<GetPersonnelResult>
<RelationValueList>
<PersonnelRelationValueUnitType>
<RelAttrId>C1</RelAttrId>
<RelationValue>1234</RelationValue>
<DateFrom>1900-01-02T00:00:00</DateFrom>
<DateTo>2199-12-31T00:00:00</DateTo>
</PersonnelRelationValueUnitType>
<PersonnelRelationValueUnitType>
<RelAttrId>R54</RelAttrId>
<RelationValue>GEN123</RelationValue>
<DateFrom>1900-01-02T00:00:00</DateFrom>
<DateTo>2017-12-04T00:00:00</DateTo>
</PersonnelRelationValueUnitType>
<PersonnelRelationValueUnitType>
<RelAttrId>R54</RelAttrId>
<RelationValue>GEN456</RelationValue>
<DateFrom>2017-12-05T00:00:00</DateFrom>
<DateTo>2099-12-31T00:00:00</DateTo>
</PersonnelRelationValueUnitType>
</RelationValueList>
</GetPersonnelResult>
</GetPersonnelResponse>
Xpath 2.0 is enabled in WSO2esb.
I need to select the RelationValue with the highest DateTo value. If there are multiple values, I take the last one.
Anyone knows how to fix this?
You use namespace xs: in your expression. You need to define it in top parent tag of it mediator.
I am trying to perform a sparse update on a QuickBooks Online Payment object using the .NET SDK. For some reason as soon as I try to specify a <Line> element in the update request, I get a ValidationError requiring a CustomerRef.
Request:
<?xml version="1.0"?>
<Payment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" sparse="true" xmlns="http://schema.intuit.com/finance/v3">
<Id>1060</Id>
<SyncToken>3</SyncToken>
<TxnDate>2014-11-25</TxnDate>
<PrivateNote />
<Line>
<Amount>390.0000</Amount>
<LinkedTxn>
<TxnId>1308</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
<TotalAmt>390.0000</TotalAmt>
</Payment>
Response:
{"Fault": {
"Error": [{
"Message":"Required param missing, need to supply the required value for the API",
"Detail":"Required parameter CustomerRef is missing in the request",
"code":"2020",
"element":"Payment"}],
"type":"ValidationFault"},
"time":"2015-01-20T07:20:15.191-08:00"}
I thought a sparse update meant that anything you did not specify stayed the same as the original entity. I can't see anything that says one way or the other in the documentation. Do I need to fetch the CustomerRef from the current entity to feed it back to the API and keep it happy, or am I just doing something wrong?
Although this is Sparse update but I believe the customerref is required, as a 'validation check for Customer' is needed when you send the Update request. This check is needed to verify that CustomerRef for Updated payment is same as the Invoice's CustomerRef. So, you should send it in your request.
I'm working on a project that aims to replace our current PDF generator with JasperReports Server. The plan is to use the REST/HTTP API to reach a high level of abstraction between the systems.
Optimally, we do not want to let JasperReports Server pull the data from the database, since this would bypass the existing logging and authorization in the calling application's architecture. Instead, we'd like to start with extracting the content in the calling application, and then pass that content to JasperReports Server.
We've done quite a bit of investigating, and the lack of relevant results indicates that this is not how you typically use JasperReports Server. The input parameters in the tutorials we've found are typically scalar values (integers, booleans or strings), and not complex structures or objects. Furthermore, it seems like more or less every sample assumes that you want to let JasperReports Server connect to a database.
If it's possible to pass in complex structures (like an array of maps, where some map elements are arrays or maps themselves), what's the best practice for doing this? I have no idea of how such a structure should be formatted in the request body. Is the SOAP API a better fit?
If this is not at all how you should design a JasperReports Server solution, what alternative products/solutions are more suitable?
Thanks in advance for any input.
After several hours spent on research, I think I'm ready to answer my own question.
JasperReports Server ("JRS" below) is fundamentally designed to fetch data by itself. Although it would be possible to force feed JRS with data, I've decided not to.
One of the most obvious drawback of not letting JRS fetch the data itself is that it would no longer be possible to generate reports from the JRS web interface. Integration from other systems also becomes impossible or difficult if the client application is responsible for supplying the data in a predefined format.
In the project I'm working on, we've decided to build a custom JRS DataSource based on the Remote XML DataSource, that invokes the client application's XML API. In other words, the client application requests a report from JRS, and JRS then requests it's data from the client application. The XML API will have to be expanded to cover all of our reporting needs, but that's a good thing in my opinion. Good API coverage will come in handy in the future.
I hope these thoughts helps someone having similar questions.
As you wrote, fetching data is more natural way for JRS. However, I needed to go the opposite way - I POST data to report sitting in JRS repo via a REST call.
I pass XML data in my parameter "xmlDocument" and, by means of a "trick", an executed report can use this XML for further X-path queries.
xmlDocument is just a simple String:
<parameter name="xmlDocument" class="java.lang.String">
<defaultValueExpression><![CDATA["<?xml version=\"1.0\" encoding=\"UTF-8\"?><documentData></documentData>"]]></defaultValueExpression>
</parameter>
At designing phase I create XML data adapter with XML file that I use for previewing. Note that a new parameter XML_INPUT_STREAM appeared after choosing XML adapter.
Then I publish the report to JRS.
During report execution, when the report is not linked to any data source, it reads XML_INPUT_STREAM parameter instead (as fallback data source), that looks as follows:
<parameter name="XML_INPUT_STREAM" class="java.io.InputStream" isForPrompting="false">
<defaultValueExpression><![CDATA[new java.io.ByteArrayInputStream($P{xmlDocument}.getBytes("UTF-8"))]]></defaultValueExpression>
</parameter>
I wrap "xmlDocument" string to InputStream.
Even if I agree with the answer, witch states that the JasperServer has been built to fetch data by itself, I had still to pass the data trough the rest API because it's the legacy way of my company to build Jasper reports and because we want to use custom Java services to fetch data.
I've found this described above to be the simpliest possible way to do this.
Having this simple custom pojo that you want to pass to the report trough web API:
public class CustomReport {
private String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public CustomReport() {
super();
}
1) Define a custom jasper scriptlet that has to be deployed on the server as a resource related to the report, witch will deserialize the string into the custom pojo object using GSON:
public class CustomScriptlet
extends JRDefaultScriptlet { public void afterReportInit()
throws JRScriptletException
{
Object customSerializedObj = getParameterValue("customSerialized");
if (customSerializedObj != null)
{
String customSerializedStr = customSerializedObj.toString();
if ((customSerializedStr != null) && (customSerializedStr.length() > 0))
{
CustomReport customReport = new Gson().fromJson(customSerializedStr,
CustomReport.class);
setVariableValue("customReport", customReport);
}
}
}
2) Use the parameter/variable with the custom scriptlet in jasper server:
<scriptlet name="Scriptlet_1" class="eu.dedalus.jasper.api.scriptlet.CustomScriptlet">
<scriptletDescription><![CDATA[CustomScriptlet]]></scriptletDescription>
</scriptlet>
<parameter name="customSerialized" class="java.lang.String"/>
<variable name="customReport" class="com.test.CustomReport" calculation="System"/>
3) Invoke the API # jasperserver/rest_v2/reportExecutions like this:
"reportUnitUri" : "/report/Custom_report",
"async":"false",
"outputFormat":"pdf",
"parameters" : {
"reportParameter" : [
{
"name": "customReport",
"value": ["{ \"content\" : \"test content\" } "]
}
]
}