I am making a call from a server that is located in US to FindItemsAdvanced of ebay finding api.
I define ListedIn as "EBAY-ENCA", however, when I make the call - I see that it doesn't return results. I believe that this is because that items are not available to US.
I see that there is a parameter called: AvailableTo - but how can I say "to all countries" ? Writing each iso code in the world could be exhausting..
My code:
ItemFilter marketFilter = new ItemFilter();
marketFilter.setName(ItemFilterType.LISTED_IN);
marketFilter.getValue().add("EBAY-ENCA");
request.getItemFilter().add(marketFilter);
ItemFilter conditionFilter = new ItemFilter();
conditionFilter.setName(ItemFilterType.AVAILABLE_TO);
conditionFilter.getValue().add("UK");
request.getItemFilter().add(conditionFilter);
In general this call should work - regardless from where you call the API. So I assume that you get an error message from the API that prevent items from being returned. Be aware that the FindItemsAdvanced call of the eBay Finding API requires either a given "categoryId" or a "keyword". Do you set any of these?
Here is the XML payload of a working call:
<findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<keywords>iPhone6</keywords>
<itemFilter>
<name>ListedIn</name>
<value>EBAY-ENCA</value>
</itemFilter>
</findItemsAdvancedRequest>
I've created an example in our API playground. It uses the XML version of the Finding API. Just execute the call to see the valid response with items included. You can adapt and customize the request parameters to your needs and see how the API responses.
The "AvailableTo" filter can only be used once per request with exactly one value. So it won't be possible to add it multiple times or to add it once with multiple values. But I'm not sure if I get your use case right. Do you really want to get only those items that are available world wide? If yes, then I'm afraid this most probably isn't possible without filtering them locally (eg. by filtering for "Worldwide" in the "shipToLocations").
Related
I am aware of the fact that I am able to use a HTTP request to use the distance matrix API (i.e. https://maps.googleapis.com/maps/api/distancematrix/json?origins=42.11622,78.10112&destinations=40.82231,72.224166&key=YOUR_API_KEY)
But I would like to simply use the Java API instead. From my understanding the first step is to create a GeoApiContext and this seems to be where I am failing. I have tried the following code:
private static GeoApiContext context = new GeoApiContext.Builder().apiKey("MyKey").queryRateLimit(500).build();
However I am just met with the following compile error:
java.land.NoClassDefFoundError: com/google/common/util/concurrent/RateLimiter
Any help on the matter would be appreciated. The plan is to use this to create a DistanceMatrix API request if that helps.
check out this link you may find it useful... there are code examples
https://www.programcreek.com/java-api-examples/index.php?api=com.google.maps.model.DistanceMatrix
Is there a way to call solrs analysis api in java using solr-core and get the analyzed tokens.
Analysis api takes fieldName or fieldType and values and give the analyzed tokens.
Is there a way to get those tokens from java?
I found the following link: FieldAnalysisRequestHandler, But I could not get any examples to use it.
In the Admin UI (for which the FieldAnalysisRequestHandler is meant) you can call it by selecting a core and then go to the "Analysis" entry.
See https://cwiki.apache.org/confluence/x/UYDxAQ or https://cwiki.apache.org/confluence/x/FoDxAQ for that.
From a client (which I guess you mean, as you tagged this question with solrj) you need to call the correct URL.
Typically the FieldAnalysisRequestHandler is bound to /analysis/field, see your solrconfig.xml.
From Solrj it should work like this:
SolrQuery query = new SolrQuery();
solrQuery.setRequestHandler("/analysis/field");
solrQuery.set("analysis.fieldtype", "mytype");
solrQuery.set("analysis.fieldvalue", "myval");
QueryResponse solrResponse = solrServer.query(solrQuery);
But it doesn't seem like there's a great support for this in Solrj, probably because it's meant to be called from the Solr Admin UI as mentioned.
I am new to apache olingo web service. I struck for the past two weeks to implement filter and pagination to my service.I am using latest olingo version 4. I google it and looked many blogs but there is no clear explanation. Kindly help me with sample code.It will be more use full for me.
Following are my scenario,
I am gettting the data from existing web service as XML and then i parse the XML using JAXB make it as list of entity in olingo web services.
Here how can i apply filter. If i having $filter in my URL means it throws page not found exception. If i remove that means it will work and give full result.
My question is How to apply olingo filter in XML string or
How to apply it in List of entity which i having it in a method.
Kindly give me the explenation with some sample code.
I need to give pagination to my response JSON.I need to limit the JSON value as 25 per page and need to next page URL also(For 25 to 50) like that.
How to implement this also.
I overcome lots of blogs but didn't work for me.
Here
https://templth.wordpress.com/2015/04/03/handling-odata-queries-with-elasticsearch/
In this blog,They didn't explain with full code.My problem is,I am getting data from existing web service as XML string and parse it and having in list of entity.
And I also refer this blog,
https://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_AdvancedRead_FilterVisitor.html
In this blog also they tell how to construct the query,My problem is how to implement $filter,$select etc from ODATA in my web service and how to filter from xml string or list of entity
Kindly suggest me with sample code.Thanks.
The Olingo team provides a huge amount of well organized help resources. The sample projects can be found by these instructions:
http://olingo.staging.apache.org/doc/odata4/tutorials/prerequisites/prerequisites.html#tutorial-sources
Complete tutorial about hte pagination can be found here:
https://olingo.apache.org/doc/odata4/tutorials/sqo_tcs/tutorial_sqo_tcs.html
I can also provide you the sample code. For example, if talking about the pagination, in your EntityCollectionProcessor implementation you just have to read the top and skip parameters and use them when generating a query to your existing web service using XML, JSON or whatever:
int skipNumber = 0;
SkipOption skipOption = uriInfo.getSkipOption();
if (skipOption != null) {
skipNumber = skipOption.getValue();
}
int topNumber = -1;
TopOption topOption = uriInfo.getTopOption();
if (topOption != null) {
topNumber = topOption.getValue();
}
EntityCollection responseEntityCollection = getDataFromService(edmEntitySet, skipNumber, topNumber);
Here the getDataFromService method generates a request to your services passing the top/skip parameters and retrieves the response. It is not advisable to filter the result set on the OData service side. Some additional steps you can find in the above mentioned tutorial.
Filtering is more complex but the main idea you can find from here:
https://olingo.apache.org/doc/odata4/tutorials/sqo_f/tutorial_sqo_f.html
When I create a new ARB subscription the response comes back and I save the id it gives us. I tried it out and it gives us back "33".
Then when the silent post callback hits our method, the response has a different id, 15631016.
15631016 is correct in matching up with the one we see in the authorize.net online portal.
So, what is 33 and why doesn't it return the real ARB ID?
Here is the code that creates the new ARB and then gets the arbId:
net.authorize.arb.Transaction arbTransaction = createARBTransaction(startDate.getTime(), creditCard, member, splitOccurrences.intValue() - 1, splitUnit, useBillingAddress, billingAddress, recurringOrder.getTotalAmount().doubleValue(), recurringOrder);
net.authorize.arb.Result<?> arbResult = (net.authorize.arb.Result<?>) merchant.postTransaction(arbTransaction);
String arbId;
if (arbResult.isOk()) {
arbId = arbResult.getResultSubscriptionId();
}
If getResultSubscriptionId() is not the correct way to get the new ARB subscription ID, what is the correct method to use?
I went through the sample code and also their community and there isn't much to go on. The only thing I can think of trying is changing:
arbResult.getResultSubscriptionId();
to:
arbTransaction.getResultSubscriptionId();
I know that doesn't sound logical but it's the best I can some up with.
According to the source code, you are using the correct method.
If you trace the calls back into the code you'll see that the subscription id gets set by the following call in importResponseMessages() of net.authorize.arb.Result
getElementText(txn.getCurrentResponse().getDocumentElement(),AuthNetField.ELEMENT_SUBSCRIPTION_ID.getFieldName());
so if you call this on your arbResult variable, you might get closer. Note that txn should be replaced by your variable arbTransaction.
Alternatively, you can dig into the response itself to see why the Authorize.net APK isn't returning the correct subscription id.
xml = arbTransaction.getCurrentResponse().dump(true);
The true determines whether the XML tree is collapsed. xml should be a string containing your XML response from authorize.net
I trying to create queues using PCF command in the WebSphere API as detailed in $MQM_HOME/samp/pcf/samples/PCF_CreateQeue.java. The creation fails when i add a description
command.addParameter(PCFConstants.MQCA_Q_DESC, "Created using MQMonitor");
I get the error: com.ibm.mq.pcf.PCFException: MQJE001: Completion Code 2, Reason 3015 : MQRCCF_CFST_PARM_ID_ERROR
Is there another way of setting the description, i'm using version 6 of the API.
The Commands page in the PCF manual states that:
The required parameters and the
optional parameters are listed. On
platforms other than z/OSĀ®, the
parameters must occur in the order:
All required parameters, in the order stated, followed by
Optional parameters as required, in any order, unless specifically
noted in the PCF definition.
The section Change, Copy and Create Queue lists the required parameters in the following order:
MQCA_Q_NAME
MQIA_Q_TYPE
Optional parameters, including QDesc
The same manual provides required parameters and their order for all PCF commands so no need to play hide-and-seek trying out parms and orders in the future.
It turns out the addParameter on the PCFMessage should in a certain sequence (stumbled on it). If i change the add parameters if works. This is not just for creating queues, but for channels as well.
command.addParameter(PCFConstants.MQCA_Q_NAME, qname);
command.addParameter(PCFConstants.MQIA_Q_TYPE, PCFConstants.MQQT_LOCAL);
command.addParameter(PCFConstants.MQCA_Q_DESC, qdesc);
command.addParameter(PCFConstants.MQIA_DEF_PERSISTENCE, PCFConstants.MQPER_PERSISTENT);
the above will execute without error.
command.addParameter(PCFConstants.MQCA_Q_NAME, qname);
command.addParameter(PCFConstants.MQCA_Q_DESC, qdesc);
command.addParameter(PCFConstants.MQIA_Q_TYPE, PCFConstants.MQQT_LOCAL);
command.addParameter(PCFConstants.MQIA_DEF_PERSISTENCE, PCFConstants.MQPER_PERSISTENT);
the above will fail after moving around the description.
I haven't seen it documented in the Java docs, and if thats the case i looks forward to some hide and seek.