Get Category ID from Product UPC - ebay-api

I would like to know that if there is any ebay API call which takes input of UPC number and return their respective ebay category ID e.g.(177) or category hierarchy (Computers/Tablets & Networking > Laptops & Netbooks > PC Laptops & Netbooks)?
Thanks in advance.
Regards,
Arshad P.

You can use the findITemByProduct call from the finding api
<?xml version="1.0" encoding="UTF-8"?>
<findItemsByProductRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<productId type="UPC">xxxxxxxxxxx(upc number)</productId>
</findItemsByProductRequest>
This would return the product data and you can get the categoryId and name from this.

Related

Hide quantity and unit price on quotation and invoice print (pdf, etc.) with OpenERP (oDoo)

I'm not selling product but services and I would like to know if it's possible to hide the unit price and the quantity when I send/print a quotation or an invoice to a customer with OpenERP (v 7.0).
I just want the final customer to know the price and not all the details.
Do you have any idea how I could do that ?
Thanks
It will hide the unit price of product if product type is service other type will be print in report.
try this code,
<para style="terp_default_Right_9">[[ line.product_id.type=="service" and removeParentNode('para') ]] [[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]]</para>
Hope this will help you.

Programmatically detect whether Amazon buyer has left a review?

Is it possible to programmatically detect whether an Amazon buyer has left a review on a product? I've been digging through the Product Advertising API to no avail.
you can use retrieving customer reviews portion of the api here:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/EX_RetrievingCustomerReviews.html
Here is an example of the request:
http://webservices.amazon.com/onca/xml?
Service=AWSECommerceService
&Operation=ItemLookup
&ResponseGroup=Reviews
&IdType=ASIN
&ItemId=B004HFS6Z0
&AssociateTag=[Your_Associate_Tag]
&AWSAccessKeyId=[Your_AWSAccessKeyId]
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request_Signature]
and response:
<Item>
<ASIN>B004HFS6Z0</ASIN>
<CustomerReviews>
<IFrameURL>
http://www.amazon.com/reviews/iframe?
akid=[Your_AWSAccessKeyId]
&alinkCode=xm2
&asin=B004HFS6Z0
&atag=[Your_AssociateTag]
&exp=2011-06-01T22%3A32%3A53Z
&v=2
&sig=pxn6bbln%2B%2FVTPJdj8oCcXvjTHmo3spkUMjbQMPbhCKI%3D
</IFrameURL>
<HasReviews>true</HasReviews>
</CustomerReviews>
</Item>
you could then sort the responses if needed.

eBay API categoryId in findItemsAdvanced call returns wrong categories

I'm trying to use the categoryId in my findItemsAdvanced query:
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId': '51148'}
The results I get are, for example (printing the searchResult dictionary):
'itemId': {'value': '200971548007'}, 'isMultiVariationListing': .............
'primaryCategory': {'categoryId': {'value': '69202'}, 'categoryName': {'value': 'Air Conditioning'}}
....."
You can see that the result has a categoryId of 69202, and not 51148.
What am I doing wrong here? I'm just using the finding.py code at:
https://github.com/timotheus/ebaysdk-python
Thanks
Edit
I've done some tests. I extracted the XML that the SDK builds. If I call with:
'categoryId': '177'
The response is:
the request_xml is <?xml version='1.0' encoding='utf-8'?><findItemsAdvancedRequest
xmlns="http://www.ebay.com/marketplace/search/v1/services"><categoryId>177</categoryId>
<itemFilter><name>Condition</name><value>Used</value></itemFilter><itemFilter>
<name>LocatedIn</name><value>GB</value></itemFilter><keywords>laptop</keywords>
<paginationInput><entriesPerPage>100</entriesPerPage><pageNumber>1</pageNumber>
</paginationInput></findItemsAdvancedRequest>
and I get the same with
'categoryId': ['177']
I find this a bit odd, I thought the appropriate name for the XML categoryId was 'CategoryId' with a capital C. If I do that I don't get an error, but the result is not restricted to the categoryId requested.
Doing it like above, I still get the error:
Exception: findItemsAdvanced: Domain: Marketplace, Severity: Error,
errorId: 3, Invalid category ID.
The code below will do a keyword search for 'laptops' across the UK eBay site and restrict the search to the two categories Apple Laptops(111422) and PC Laptops & Netbooks(177). In addition the results are filtered to only show the first 25 used items that are priced between £200 and £400. The results are also sorted by price from high to low.
There are a few things to keep in mind about this example.
It assumes that you have already installed ebaysdk-python.
According to the eBay docs the categoryId field is a string and more than one category can be specified. An array is therefore used to hold the category ids that we are interested in.
Our request needs to search for items in the UK eBay site. We therefore pass EBAY-GB as the siteid parameter.
Category ids are different across each eBay site. For example the category PC Laptops & Netbooks(177) does not exist in Belgium. (Which incidently is the site that is used in the ebaysdk-python finding.py example.)
This example is also available as a Gist
import ebaysdk
from ebaysdk import finding
api = finding(siteid='EBAY-GB', appid='<REPLACE WITH YOUR OWN APPID>')
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId' : ['177', '111422'],
'itemFilter': [
{'name': 'Condition', 'value': 'Used'},
{'name': 'MinPrice', 'value': '200', 'paramName': 'Currency', 'paramValue': 'GBP'},
{'name': 'MaxPrice', 'value': '400', 'paramName': 'Currency', 'paramValue': 'GBP'}
],
'paginationInput': {
'entriesPerPage': '25',
'pageNumber': '1'
},
'sortOrder': 'CurrentPriceHighest'
})
dictstr = api.response_dict()
for item in dictstr['searchResult']['item']:
print "ItemID: %s" % item['itemId'].value
print "Title: %s" % item['title'].value
print "CategoryID: %s" % item['primaryCategory']['categoryId'].value
I hope the following will explain why performing a search on the Belgium site results in items that contain the category 177 even though this is not valid for Belgium but is valid for the UK.
Basically eBay allow sellers from one site to appear in the search results of another site as long as they meet the required criteria, such as offering international shipping. It allows sellers to sell to other countries without the need to actually list on those sites.
From the example XML that elelias provided I can see that a keyword search for 'laptop' was made on the Belgium site with the results filtered so that only items located in the UK was to be returned.
<itemFilter>
<name>LocatedIn</name>
<value>GB</value>
</itemFilter>
Because the search was limited to those located in the UK you won't see any Belgium items in the results. Since the items where listed on the UK site they will contain information relevant to the UK. For example the category id 177. eBay does not convert the information to make it relevant to the site that you are searching on.
It is important to remember that what ever you are trying to do with the Finding API can also be repeated using the actual advance search on eBay. For example it is possible to re-create the issue by performing a keyword search for used items on the Belgium site.
This url is the equivalent of your code that was performing the search without specifying the category 177. As you can see from the results it returns items that where listed on the UK site but which are appearing in the Belgium site. It you click on some of the items, for example, you can even see that it displays the UK category PC Laptops & Netbooks (177) even though this does not exist on the Belgium site. This matches the results form your code where it was returning 177 but would not let you specify the same value in the request as you was searching the Belgium site.
I hope this helps.
Because categoryId is repeatable. You will need to pass an array into the call. Something like this should work.
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId': [
{'51148'}
]
}
Note: See how the itemFilter element is an array in the sample file of the SDK.
'itemFilter': [
{'name': 'Condition',
'value': 'Used'},
{'name': 'LocatedIn',
'value': 'GB'},
],

Clearer response from BigCommerce

Can BigCommerce change their API response to be more clear when a program tries to post a shipment that already exists?
When posting shipments to BigCommerce, if the shipment already exists, then you receive the following error message.
<?xml version="1.0"?>
<errors>
<error>
<status>400</status>
<message>The field 'quantity' is invalid.</message>
<details>
<invalid_reason>The quantity specified is greater than the quantity of the product that is available to ship.</invalid_reason>
<available_quantity>0</available_quantity>
<order_product_id>628</order_product_id>
</details>
</error>
</errors>
I agree that it is a bad request, but it has nothing to do with the quantity of the item. Can we do something like the following for the message or invalid_reason instead?
The shipment [insert ID here] already exists and cannot be added.
This would make for a much more usable API.
When querying the order products resource there is an available quantity to ship, and as you create a shipment(s) the available quantity is reduced to 0.
Initially a shipment POST is successful as the quantity specified in the payload matches that of the order. If you were to POST a shipment to an order that has already been shipped then the available quantity is actually 0, and when you specify a positive integer for quantity in the payload it is invalid and greater than the available quantity, so the error is accurate.

How can I search for albums with generic titles using the Spotify Web API?

It is possible to search by name for an album in the Spotify catalog using the Spotify Web API.
However, if the album name is a common word or phrase, the search response may contain thousands of results. I can't see a way to narrow the search by artist name.
Here is an example: searching for album Country by artist Giant Panda Guerilla Dub Squad.
The API request is:
http://ws.spotify.com/search/1/album?q=country
The response is:
<?xml version="1.0" encoding="UTF-8"?>
<albums xmlns="http://www.spotify.com/ns/music/1" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<opensearch:Query role="request" startPage="1" searchTerms="country" />
<opensearch:totalResults>11861</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>100</opensearch:itemsPerPage>
<album href="spotify:album:1Wcnyz2zYWLIPZ1K63RXdW">
<name>How Country Feels</name>
<artist href="spotify:artist:56x8mYvS3cyDGAi8N2FxbB">
<name>Randy Houser</name>
</artist>
<id type="upc">886443789852</id>
<popularity>0.73964</popularity>
<availability>
<territories>CA US</territories>
</availability>
</album>
...more albums...
</albums>
There are 11861 results, and the results are paged, with 100 albums per page. A request can be made to get the next page, but if the album I'm looking for is on the last page I will have to make 118 separate requests to the API before I find it.
Is there a better way?
You can use the advanced search query language to help, especially if you know the artist in advance. For example:
http://ws.spotify.com/search/1/album?q=artist:Giant Panda Guerilla Dub Squad
...will limit the search to albums by that artist.
http://ws.spotify.com/search/1/album?q=artist:Giant Panda Guerilla Dub Squad Country
...will return only the album you want.
The full advanced search reference is currently unavailable in the chaos that was the new Spotify redesign, but you can find it in the Wayback machine here.