Walmart Paginated Products API - walmart-api

I am attempting to use the Paginated Products API to make a GET request using the optional specialOffer parameter. I have made many requests with multiple variations of the parameters available and have received an empty JSON object for each request whenever I use the specialOffer parameter. However, when I use the other optional parameters available without the specialOffer parameter, such as category, brand, format, and count, I receive the expected response.
Example requests that returns empty JSON object:
http://api.walmartlabs.com/v1/paginated/items?apiKey=APIKEY&specialOffer=specialBuy
http://api.walmartlabs.com/v1/paginated/items?apiKey=APIKEY&category=3944_1060825_1939756&specialOffer=specialBuy&count=10
Example request that returns expected results:
http://api.walmartlabs.com/v1/paginated/items?apiKey=APIKEY&category=3944_1060825_1939756&count=10
In addition to this, I have ensured that there are items available which are in the specialBuy (as well as rollback and clearance) categories, by checking the Special Feeds like so:
http://api.walmartlabs.com/v1/feeds/specialbuy?apikey=APIKEY&categoryId=3944_1060825_1939756
Documentation for the Paginated Products API:
https://developer.walmartlabs.com/docs/read/Paginated_Products_API
Can anyone shed some light on this issue?

Related

Cannot bind query parameter; Unknown name basicRequest when retrieving basic insights for a location

I'm trying to retrieve insights for a location using the Google Business Profile API. I've tried a few approaches, but I always get an error about "Cannot bind query parameter".
According to the docs, I should be posting to this URL: https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights
and in the body, pass in an array of locationNames, but when I do that, I get the error about "Cannot bind query parameter 'locationNames'".
So I just tried doing a GET on this URL and pass in the names on the name querystring and that worked just fine to get the high-level data.
https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights?name=accounts/xxx/locations/xxx
So I know I have the right account ID, location ID, etc. But I need to be able to add in the basicRequest parameter so I can indicate which metric that I want to retrieve.
So I've POST to both of those URLS above with a body that looks like this:
{"basicRequest":{"metricRequests":[{"metric":"ALL"}],"timeRange":{"startTime":"2020-10-12T01:01:23.045123456Z","endTime":"2022-01-10T23:59:59.045123456Z"}}}
But again, I get the same errors about "Cannot bind query parameter" to field "basicRequest" (Same as when I tried to pass in the "locationNames" param in the JSON.
So clearly, I'm doing something wrong with how I am sending in the parameters in the body because it doesn't seem to think any of those parameter names are valid. My end goal is to be able to retrieve queries_direct, actions_total, etc.
I'm using Ruby, and there isn't a client library for it, so I'm just crafting the URLs and the JSON body and doing a GET or POST to it.
Greatly appreciate any pointers!

Extracting skiptoken to make next request safely

I am trying to retrieve all of a user's ownedObjects. If the user has more than 999 ownedObjects, then the results contain a nextLink.
The documentation here states that skiptoken should not be extracted to make a different request.
However, I would like to extract it to make my next request. If the other parts of the original request URL match the corresponding parts of the nextLink request URL, would this be safe?
According to your description, I assume you want to make an different request to get more result of the user's owenedObjects.
Based on my test, we can use the nextLink property to make a different request.
As the description of the official document, Do not try to extract the $skiptoken or $skip value and use it in a different request.

facebook graph api returns error 2500 when there are commas in the id url

I'm attempting to retrieve the "shares" graph data for a number of pages in JSON format. I suspect that the errors I am encountering stem from the fact that some of the URLs have commas in them, and are being parsed as an attempt to pass multiple ids.
Returns graph data.
https://graph.facebook.com/?ids=http://celebritybabies.people.com/2012/08/23/backstreet-boys-howie-dorough-expecting-second-son/
Returns error 2500 "Cannot specify an empty identifier"
https://graph.facebook.com/?ids=http://www.people.com/people/article/0,,20624518,00.html
Encode the commas, still returns 2500
https://graph.facebook.com/?ids=http://www.people.com.people.article/0%2C%2C20624518%2C00.html
There doesn't seem to a way around it other than to use the normal inspection
http://graph.facebook.com/http://www.people.com/people/article/0,,20624518,00.html
You may have to file a bug at http://developers.facebook.com/bugs though I feel as the answer would most likely be "Status by design".
You could try using FQL instead, querying the link_stat table:
SELECT url, normalized_url, share_count, comments_fbid FROM link_stat
WHERE url = 'http://www.people.com/people/article/0,,20624518,00.html'
(See result in Graph API Explorer.) You can also use WHERE url IN ("…", "…", …) to check multiple URLs at once.
This also returns a comments_fbid of 10151022112466453, and that one you can look up via the API, https://graph.facebook.com/10151022112466453
Maybe this can work as a workaround, until Facebook fixes this problem.

Different result when using GET/POST in elastic search

I am experimenting with elastic search via the Elastic Search Head plugin.
The results are as expected when I submit a query via POST.
However when I try the same query using GET, I always get back all values in the index.
So : how to pass the query to the elastic search server via GET so I can use the search string in an URL?
If you send a GET the body is probably not even sent to elasticsearch, so you are basically sending no query to the _search endpoint, which is why you are getting everything back (of course only the first 10 results based on the default size parameter).
Have a look at the URI request, which allows you to send basic queries using the q parameter within the URI. You can use the Lucene query syntax and specify some other parameters listed in the linked page. If you then want to execute more advanced queries, you might want to express them as JSON queries in order to get all the benefits of the elasticsearch Query DSL, but you'd need to provide them as body of the request.
UPDATE
Looking deeper at the elasticsearch head plugin, the query is not sent as the request body when you select the GET method but within the URL itself and without specifying the name for the parameter, like this:
http://localhost:9200/_search&{"query":{"term":{"text":"john"}}}
That is probably a bug in the plugin itself and elasticsearch can't find the query, that's why you get all the results back. That means that only the POST method works while sending queries with elasticsearch head.
Elasticsearch allows to use both GET and POST for executing queries. If you use GET you can either send the query as body or use the source parameter like this:
http://localhost:9200/_search?source={"query":{"term":{"text":"john"}}}

URL length limit for google reader api

I am using "/reader/api/0/stream/items/ids" API to get the item ids for sources that I want.
I have quite a number of sources, so I repeated "s=" parameter to include in the api url.
However, google has given me an error of "URL is too long".
So the question is that How can I solve it so that I just use one time api call to get item ids for that many sources?
Thanks
It seems that /reader/api/0/stream/items/ids path supports a POST method. This means the amount of data you could pass by using POST verb is much more than by using a query string and a GET method.
So use https://www.google.com/reader/api/0/stream/items/ids URL for the post, and pass your query string as a post data. Don't forget to include an action token(T) which is required for POST requests.

Resources