eBay Browse API limiting the number of category_ids to 1, but documentation says you can add multiple category_ids - ebay-api

When performing a GET request to the eBay browse API I am getting the following error message:
<class 'list'>: [{'errorId': 12030, 'domain': 'API_BROWSE', 'category': 'REQUEST', 'message': 'The number of categories in the request has exceeded the limit. Please reduce the number of categories to 1 or less.', 'parameters': [{'name': 'allowedMaxCategories', 'value': '1'}]}]
Here is the URL of the request I am trying to make:
https://api.ebay.com/buy/browse/v1/item_summary/search?category_ids=58058,11700,293,15032,1249,625&filter=sellers:{foo}&limit=100&sort=newlyListed
However, the documentation for the Browse API suggests that you can pass category_ids as a string array separated by commas.
The category ID is used to limit the results. This field can have one category ID or a comma separated list of IDs.
Here is a link to the documenation for the Browse API:
https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search#h2-input

I have tested your code in eBay api explorer, i received warning response of your defined filters not category, after corrected filters i received success response with records.
Check this query
https://api.sandbox.ebay.com/buy/browse/v1/item_summary/search?category_ids=58058,11700,293,15032,1249,625&limit=100&sort=newlyListed&filter=sellers:%7Bfoo%7D
NOTE: the seller foo not found so return success with 0 record but without seller or a valid seller id return success with records

Related

How to retrieve orders list from Square using Square API V2

I'm attempting to get a list of recent transactions/orders from the Square Connect API V2 that lists out exactly what was purchased.
I tried the suggestion posted here:
How to retrieve Square orderIds for Call to BatchRetrieveORders
and received the error "Provided merchant_id and merchant_id in authorization do not match up."
I also attempted "v2/locations/(locationID)/orders/batch-retrieve" and received the error:
{
"success": false,
"message": {
"resource_bundle_name": "com.squareup.webservice.WebserviceMessages",
"key": "there.was.a.problem.processing.this.request",
"arguments": []
},
"debug_info": ""
}
I am able to get a list of transactions, but it isn't useful to me without the item information.
I'm using a personal account with the Personal Access Token.
This looks like a well-handled error in terms of its messaging. I suspect that the error message is telling you what you need to know. From this post, a Square employee mentioned that the cause is likely that you are:
using OAuth credentials for one merchant but attempting to retrieve data for another merchant. For example, if you have OAuth tokens for merchant A with location B but try to list payments for location token X that belongs to a different merchant Y, you will get this error.
You should validate that the token you're using is correct for the merchant you're trying to retrieve data for. If you're certain it's correct, I'd reach out to Square directly as there may be an issue with this token.

Given node for Storefront.Product with string id, how to get productId for Admin API

I'm using GraphQL shopify buy-sdk for Android, and getting node for Product, by string id like:
"id" -> "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzEwMDcyMDgwOTc1"
this is node id
but to get, say, product metafields, i have to make request to Admin API
https://SHOP.myshopify.com/admin/products/{productId}/metafields.json
where {productId} is numeric id of Product, like:
6243834538
I cannot use node id in REST API request, getting 400 "Bad Request".
So the question is - how to get numeric product id for node in GraphQL?
Thanks!
You can simply do a base64 decode to the string id. By decoding (base64) the string you gave in the example I found something like this.
gid://shopify/Product/10072080975
You can trim the string to get the product id from the end and can use in the rest api of shopify admin api.

eBay API: retrieve full item listing by SiteID

Does anyone know how to retrieve a full listing of items by Site (ebay.us, ebay.fr ..) using ebay API?
I am using the Large Merchant Service because I manage thousands of items on each site (about 100k).
https://developer.ebay.com/devzone/large-merchant-services/concepts/lms_apiguide.html
1st solution i have tried (Active Inventory Report) According the doc :
Retrieving an Active Inventory Report
The ActiveInventoryReportRequest allows you to download a description
of all of your active listings by SKU. The SKU details include ItemID,
Price, Quantity, SKU, and SiteID.
I have checked with premium support and there is a mistake, SiteID is never included in response.
2nd solution (GetSellerList)
https://developer.ebay.com/devzone/xml/docs/reference/ebay/GetSellerList.html
According to the docs:
GetSellerList returns a maximum of 5,000 items per call (this is possible if you do not specify a Detail Level, and thus return the
smallest set of data for each item). However, if you specify any
DetailLevel value (and thus increase the fields returned for each
item), you might need to use Pagination values to obtain the complete
result set. If you use a DetailLevel, the response can contain no more
than 200 items per call.
So can not use this one because of limitation to 5000 items and I do not know when items have been added, a few years ago for a bunch of them.
Any ideas?
Regards
You can get lots more than 5,000 results with GetSellerList, but you are right you can only get 200 at a time. The code below is part of a loop iterating through until HasMoreItems is false. The code is written in Perl and uses Net::eBay to connect.
my $result = $eBay->submitRequest( "GetSellerList",
{
UserID => "$ebay_settings{'ebay_account'}",
GranularityLevel => 'Medium',
EndTimeFrom => "$start_time",
EndTimeTo => "$end_time",
Pagination => {
EntriesPerPage => 200,
PageNumber => $page_number
}
}
);
if( ref $result ) {
$result->{HasMoreItems} eq "false" and $done = "Y";
}

eBay API findItemsAdvanced call ignores categoryID

Any attempt to make an eBay API call to findItemsAdvanced is ignoring the categoryID parameter.
For example, I want to find all auctions matching "1943" in the "Video Games" category (ID #1249). eBay instead returns a bunch of auctions for coins instead.
This is the URL I am using:
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.13.0&SECURITY-APPNAME=AppID&GLOBAL-ID=EBAY-US&keywords=1943&categoryid=1249
Problem solved: I was using "categoryid" instead of "categoryId." (sigh)

Instagram API error

I using Instagram API to get user info
api = InstagramAPI(access_token=access_token)
profile = api.user(user_id="kallaucyahoocojp") # I try to put output data to profile variable here
And I get the below error:
DownloadError: Unable to fetch URL: https://api.instagram.com/v1/users/kallaucyahoocojp.json?access_token=(u'1191812153.f78cd79.d2d99595c79d4c23a7994d85ea0d412c', {u'username': u'kallaucyahoocojp', u'bio': u'\u30c4\u30a4\u30c3\u30bf\u30d5\u30a9\u30ed\u30ef\u30fc\u5897\u52a0\u30b5\u30fc\u30d3\u30b9', u'website': u'http://twitter\u30d5\u30a9\u30ed\u30ef\u30fc.jp', u'profile_picture': u'http://images.ak.instagram.com/profiles/anonymousUser.jpg', u'full_name': u'Kallauc', u'id': u'1191812153'})
Can anybody help me to fix it?
You need to pass the numeric-based user id, rather than the username. For example, instead of passing kallaucyahoocojp, you might pass 1234 if t
Here's how to get the ID if you don't have it:
Search for the instagram user id using this endpoint. In the python api:
api.user_search(q="kallaucyahoocojp", count=100)
Check the results for an exact string match on each user name while iterating through the results (calling .lower() to be sure to ignore potential case issues).
If you don't find the user in the first page of results, call to the next page using the max id returned.
Get the user id object from the returned from the matching users search result, then call your original function again with the numeric id.
A couple of very important notes:
Notice that I called the search function for users with a count of 100. You can pick any number, but contrary to other SO posts, the first user is not always the user you want in a search. The search can and will match partials, and not always according to an exact match first. How do I know? I have production instagram apps. I will qualify and say that usually the results are in the first 2-3 matches. Decide what is cheaper; repeated API calls that bring you closer to the limit, or 1 large bulk call where you are certain to get all the results.
The python Instagram API last I checked does a terrible job returning paging information. You actually get the paging URL which defeats the purpose of the python API itself to get additional pages. Your options are extract the next id parameter from the URL using urlparse or something similar, or fix the API to return the paging data as an object per the json (I've done both). What happens is the API itself is discarding part of the json and only giving you the URL which normally you don't want/need.
In your example, here's the search response:
{
"meta": {
"code": 200
},
"data": [
{
"username": "kallaucyahoocojp",
"bio": "ツイッタフォロワー増加サービス",
"website": "http://twitterフォロワー.jp",
"profile_picture": "http://images.ak.instagram.com/profiles/anonymousUser.jpg",
"full_name": "Kallauc",
"id": "1191812153"
}
]
}
Revising your call:
api = InstagramAPI(access_token=access_token)
profile = api.user(user_id="1191812153")
I should note that you may not need to call the user call if you did a search because you may simply have all the info you need. It will depend on what you are doing of course, so I am giving you the general method to use the rest of the user api.
For extracting profile info using Instagram API, userid is required.
The endpoint for extracting userID:
https://api.instagram.com/v1/users/search?q=[username]&access_token=[HERE]
The endpoint for extracting profile info:
https://api.instagram.com/v1/users/[userid]/?access_token=[HERE]
Note that before extracting information, check the login permissions for your access token.