Conduct ItemSearchBasic for items with particular price level? - soap

I'm using an iPaaS which leverages NetSuite's SOAP web services to provide RESTlike read/write access to NetSuite account data. These endpoints support searches, but from what I can tell in the NetSuite SOAP Web Services Usage Log, they are only _____SearchBasic. Example partial request body:
...
<soapenv:Body>
<search xmlns="urn:messages_2019_1.platform.webservices.netsuite.com">
<searchRecord xsi:type="ns10:ItemSearch" xmlns:ns10="urn:accounting_2019_1.lists.webservices.netsuite.com">
<ns10:basic xsi:type="ns11:ItemSearchBasic" xmlns:ns11="urn:common_2019_1.platform.webservices.netsuite.com">
// additional search parameter(s) here?
<ns11:type xsi:type="ns13:SearchEnumMultiSelectField" operator="anyOf" xmlns:ns13="urn:core_2019_1.platform.webservices.netsuite.com">
<ns13:searchValue xsi:type="xsd:string">_assembly</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_description</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_discount</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_downloadItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_giftCertificateItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_inventoryItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_itemGroup</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_kit</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_markup</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_nonInventoryItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_otherCharge</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_payment</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_service</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_subtotal</ns13:searchValue>
</ns11:type>
</ns10:basic>
</searchRecord>
</search>
</soapenv:Body>
...
I need to search for items in NetSuite that belong to a particular price level. I've look at the ItemSearchBasic schema and can't find quite what I need. For instance, I can search for items that have a specific price, and the items that are returned contain a pricingMatrix with pricing objects with a priceLevel, but I can't seem to search for a priceLevel with an ItemSearchBasic. Example partial response with the fields I care about:
...
<platformCore:recordList>
<platformCore:record xsi:type="listAcct:InventoryItem" externalId="1810" internalId="642" xmlns:listAcct="urn:accounting_2019_1.lists.webservices.netsuite.com">
...
<listAcct:isInactive>false</listAcct:isInactive>
<listAcct:currency>5</listAcct:currency>
<listAcct:pricingMatrix>
<listAcct:pricing>
<listAcct:currency internalId="1">
<platformCore:name>USA</platformCore:name>
</listAcct:currency>
<listAcct:priceLevel internalId="1">
<platformCore:name>Retail/Web</platformCore:name>
</listAcct:priceLevel>
<listAcct:priceList>
<listAcct:price>
<listAcct:value>12.0</listAcct:value>
</listAcct:price>
</listAcct:priceList>
</listAcct:pricing>
...
In summary, my question is two-fold:
How can I search for items belonging to a particular price level with an ItemBasicSearch?
If that's not possible, how can I search for items belonging to a particular price level using the NetSuite SOAP web services?
Alternatively, I believe I could get the data I need by retrieving items that exist at a particular location (as in, have a quantity of zero or more at a particular location). Is there a way to query for that within an ItemBasicSearch?
Forgive me if I'm missing something or using the wrong terminology. I'm new to both NetSuite and SOAP.

Please use Itemsearchadvanced.
soapenv:Body
<ns10:basic xsi:type="ns11:ItemSearchAdvanced" xmlns:ns11="urn:common_2019_1.platform.webservices.netsuite.com">
// additional search parameter(s) here?
<ns11:type xsi:type="ns13:SearchEnumMultiSelectField" operator="anyOf" xmlns:ns13="urn:core_2019_1.platform.webservices.netsuite.com">
<ns13:searchValue xsi:type="xsd:string">_assembly</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_description</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_discount</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_downloadItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_giftCertificateItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_inventoryItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_itemGroup</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_kit</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_markup</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_nonInventoryItem</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_otherCharge</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_payment</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_service</ns13:searchValue>
<ns13:searchValue xsi:type="xsd:string">_subtotal</ns13:searchValue>
</ns11:type>
</ns10:basic>
</soapenv:Body>

Related

How to get the address from coordinates with Open Street Maps API?

I developed an open-source APP in Cordova (it uses Javascript) and I'm using the Google Maps API, though as the APP is becoming popular my bill is increasing (not nice for a free, ad-free APP). Thus I'd like to move to Open Street Maps.
I've been reading the docs about the Overpass API but I see no simple clear examples of code implementation. I know the sever to use, that I should use HTTP GET requests and use their special XML syntax. But it's not clear how do I pass that XML to the GET request. Furthermore the examples regarding coordinates provides as input a boundary box, not a point (or a point is regarded as a square whose corners are the same?).
<union>
<bbox-query s="51.249" w="7.148" n="51.251" e="7.152"/>
<recurse type="up"/>
</union>
<print mode="meta"/>
Could you kindly provide a simple example in Javascript (for example with $.ajax) on how to get the address of a certain location by providing the geo-coordinates to the API?
Another endpoint, and a short snippet:
fetch("https://nominatim.openstreetmap.org/search.php?q=48.886,2.343&polygon_geojson=1&format=json")
.then(response => response.json())
.then(j => {
console.log(j[0].display_name)
})
After some hours around, I share with you the working solution. Apparently, we should use the Nominatim service from Open Street Maps, and therein the reverse geocoding service. Please read the usage policy to avoid abuses, since this is a completely free service.
const coord = [38.748666, -9.103002]
fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coord[0]}&lon=${coord[1]}&format=json`, {
headers: {
'User-Agent': 'ID of your APP/service/website/etc. v0.1'
}
}).then(res => res.json())
.then(res => {
console.log(res.display_name)
console.log(res.address)
})

Extract only data (without response element) using MarkLogic search API with REST

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,

Twitter API geo

I am really new to this and I am trying to use Twitter's API to get geo information. It seems pretty straight forward. Enter Latitude/Longitude and the distance to search from this point in either mi. or km but I don't know how/where I am supposed to enter my API key or what format/order it is supposed to be in; where it is supposed to be located, etc... here is sample:
https://api.twitter.com/1.1/search/tweets.json?q=%20&geocode=37.781157%2C-122.398720%2C10mi
so where do I put my credentials and in what order etc... I just can't find any info.
As always, all help is greatly appreciated...
You can't submit credentials via a URL. With python you can use this library:
TwitterAPI
from TwitterAPI import TwitterAPI
SEARCH_TERM = 'pizza'
GEOCODE = '37.781157,-122.398720,10mi'
api = TwitterAPI(<consumer key>, <consumer secret>, <access token key>, <access token secret>)
r = api.request('search/tweets', {'q':SEARCH_TERM, 'geocode':GEOCODE})
for item in r:
print(item['text'] if 'text' in item else item)

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": {
"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>

ValidationError when sparse updating a Payment trying to specify new LinkedTxn lines

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.