Merchandising API Class
The Merchandising API provides developers with an easy way to surface available items and products on eBay that are good value or are otherwise popular with eBay buyers. Shopping portals and widgets can use the API and create applications that engage users with contextually relevant products and items.
Usage
from ebaysdk.merchandising import Connection as Merchandising
try:
api = Merchandising(appid="YOUR_APPID", config_file=None)
response = api.execute('getMostWatchedItems', {'maxResults': 10})
print(response.dict())
print(response.reply)
except ConnectionError as e:
print(e)
print(e.response.dict())
Usage With YAML
Place a YAML file in your home or /etc/ directory and reference that filename when constructing the object. The default YAML filename is "ebay.yaml". If you use this name, it will automatically get picked up.
from ebaysdk.merchandising import Connection as Merchandising
api = merchandising(config_file='myfile.yaml')
response = api.execute('getMostWatchedItems', {'maxResults': 10})
print(response.dict())
Sandbox Usage
from ebaysdk.merchandising import Connection as Merchandising
api = Merchandising(domain='svcs.sandbox.ebay.com', appid="YOUR_APPID")
response = api.execute('getMostWatchedItems', {'maxResults': 10})
print(response.dict())
Public Methods
Merchandising(**kwargs)
Keyword arguments to Merchandising() constructor
domain -- API endpoint (default: svcs.ebay.com)
config_file -- YAML defaults (default: ebay.yaml)
debug -- debugging enabled (default: False)
warnings -- warnings enabled (default: False)
uri -- API endpoint uri (default: /MerchandisingService)
appid -- eBay application id
siteid -- eBay country site id (default: EBAY-US)
compatibility -- version number (default: 1.0.0)
https -- execute of https (default: False)
proxy_host -- proxy hostname
proxy_port -- proxy port number
timeout -- HTTP request timeout (default: 20)
parallel -- ebaysdk parallel object
response_encoding -- API encoding (default: XML)
request_encoding -- API encoding (default: XML)
execute(verb, data)
Execute the HTTP request.
response = api.execute('getMostWatchedItems', {'maxResults': 20})
error()
Returns a string of the HTTP call errors
if api.error():
print "has errors: %s" % api.error()
response.dom()
Return a DOM object (lxml dom) of the HTTP response content.
response.dict()
Return a dictionary of the HTTP response content.
response.content
Return the string content from the HTTP response call.
response.reply
Return the response data object.
response_code()
Return the HTTP response code.
response_status()
Return the HTTP response status.
API Use Cases
- Improved Buying Experience
- Increase Affiliate Commission Revenue
- Optimize Your Selling Strategy