BigW Consortium Gitlab

Commit a2567f60 by Joe Paul

Fix HTTP body none issue

parent a3eac450
{}
\ No newline at end of file
language: python
python:
- "2.7"
# command to install dependencies
install: "pip install -r requirements_dev.txt"
# before script run flake8
before_script: flake8 .
# command to run tests
script: python -m pytest test
......@@ -19,7 +19,7 @@ $ python setup.py build
$ sudo python setup.py install
</pre>
## Simple Example
## Example without authentication
To use, first [register for an Etsy developer key](http://developer.etsy.com/).
Below is an example session.
......@@ -37,6 +37,29 @@ Type "help", "copyright", "credits" or "license" for more information.
</pre>
## Example with authentication
To use, first [register for an Etsy developer key](http://developer.etsy.com/).
Below is an example session.
<pre>
$ python
python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from etsy import Etsy
>>> from etsy.oauth import EtsyOAuthClient
>>> from etsy import EtsyEnvProduction
>>> etsy_env = EtsyEnvProduction()
>>> etsy_oauth_client = EtsyOAuthClient('consumer_token','consumer_secret')
>>> signin_url = etsy_oauth_client.get_signin_url()
>>> etsy_oauth_client.set_oauth_verifier(verifier_received_from_signin_url)
>>> etsy_api = Etsy(etsy_oauth_client=etsy_oauth_client, etsy_env=etsy_env)
>>> etsy_api.getUser(user_id="__SELF__")
</pre>
See also [this blog post](http://codeascraft.etsy.com/2010/04/22/announcing-etsys-new-api/)
on Code as Craft.
......
from _v2 import EtsyV2 as Etsy
from etsy_env import EtsyEnvSandbox, EtsyEnvProduction
from _v2 import EtsyV2 as Etsy # noqa
from etsy_env import EtsyEnvProduction # noqa
__version__ = '0.3.1'
__author__ = 'Dan McKinley'
__author__ = 'Dan McKinley & Fulfil.IO Inc.'
__copyright__ = 'Copyright 2010, Etsy Inc.'
__license__ = 'GPL v3'
__email__ = 'dan@etsy.com'
......@@ -13,25 +13,24 @@ from _multipartformdataencode import encode_multipart_formdata
missing = object()
class TypeChecker(object):
def __init__(self):
self.checkers = {
'int': self.check_int,
'float': self.check_float,
'string': self.check_string,
}
}
def __call__(self, method, **kwargs):
params = method['params']
for k, v in kwargs.items():
if k == 'includes': continue
if k == 'includes':
continue
if k not in params:
raise ValueError('Unexpected argument: %s=%s' % (k, v))
t = params[k]
checker = self.checkers.get(t, None) or self.compile(t)
ok, converted = checker(v)
......@@ -40,7 +39,6 @@ class TypeChecker(object):
"Bad value for parameter %s of type '%s' - %s" % (k, t, v))
kwargs[k] = converted
def compile(self, t):
if t.startswith('enum'):
f = self.compile_enum(t)
......@@ -49,37 +47,32 @@ class TypeChecker(object):
self.checkers[t] = f
return f
def compile_enum(self, t):
terms = [x.strip() for x in t[5:-1].split(',')]
def check_enum(value):
return (value in terms), value
return check_enum
def always_ok(self, value):
return True, value
def check_int(self, value):
if isinstance(value, long):
if isinstance(value, long): # noqa
return True, value
return isinstance(value, int), value
def check_float(self, value):
if isinstance(value, int):
return True, value
return isinstance(value, float), value
def check_string(self, value):
return isinstance(value, basestring), value
return isinstance(value, basestring), value # noqa
class APIMethod(object):
def __init__(self, api, spec):
"""
Parameters:
......@@ -92,7 +85,7 @@ class APIMethod(object):
'string', 'materials': 'array(string)', 'shipping_template_id':
'int', 'quantity': 'int', 'shop_section_id': 'int'}, 'defaults':
{'materials': None, 'shop_section_id': None}, 'type': 'Listing',
'description': 'Creates a new Listing'}
'description': 'Creates a new Listing'}
"""
self.api = api
......@@ -100,14 +93,12 @@ class APIMethod(object):
self.type_checker = self.api.type_checker
self.__doc__ = self.spec['description']
self.compiled = False
def __call__(self, *args, **kwargs):
if not self.compiled:
self.compile()
return self.invoke(*args, **kwargs)
def compile(self):
uri = self.spec['uri']
self.positionals = re.findall('{(.*)}', uri)
......@@ -118,7 +109,6 @@ class APIMethod(object):
self.compiled = True
def invoke(self, *args, **kwargs):
if args and not self.positionals:
raise ValueError(
......@@ -142,13 +132,12 @@ class APIMethod(object):
del kwargs[p]
self.type_checker(self.spec, **kwargs)
return self.api._get(self.spec['http_method'], self.uri_format % ps, **kwargs)
return (self.api._get(self.spec['http_method'],
self.uri_format % ps, **kwargs))
class MethodTableCache(object):
max_age = 60*60*24
max_age = 60 * 60 * 24
def __init__(self, api, method_cache):
self.api = api
......@@ -156,30 +145,25 @@ class MethodTableCache(object):
self.used_cache = False
self.wrote_cache = False
def resolve_file(self, method_cache):
if method_cache is missing:
return self.default_file()
return method_cache
def etsy_home(self):
return self.api.etsy_home()
def default_file(self):
etsy_home = self.etsy_home()
d = etsy_home if os.path.isdir(etsy_home) else tempfile.gettempdir()
return os.path.join(d, 'methods.%s.json' % self.api.api_version)
def get(self):
ms = self.get_cached()
if not ms:
ms = self.api.get_method_table()
self.cache(ms)
return ms
def get_cached(self):
if self.filename is None or not os.path.isfile(self.filename):
......@@ -193,10 +177,10 @@ class MethodTableCache(object):
self.api.log('Reading method table cache: %s' % self.filename)
return json.loads(f.read())
def cache(self, methods):
if self.filename is None:
self.api.log('Method table caching disabled, not writing new cache.')
self.api.log(
'Method table caching disabled, not writing new cache.')
return
with open(self.filename, 'w') as f:
json.dump(methods, f)
......@@ -204,22 +188,21 @@ class MethodTableCache(object):
self.api.log('Wrote method table cache: %s' % self.filename)
class API(object):
def __init__(self, api_key='', key_file=None, method_cache=missing,
def __init__(self, api_key='', key_file=None, method_cache=missing,
log=None):
"""
Creates a new API instance. When called with no arguments,
reads the appropriate API key from the default ($HOME/.etsy/keys)
file.
Creates a new API instance. When called with no arguments,
reads the appropriate API key from the default ($HOME/.etsy/keys)
file.
Parameters:
api_key - An explicit API key to use.
key_file - A file to read the API keys from.
method_cache - A file to save the API method table in for
key_file - A file to read the API keys from.
method_cache - A file to save the API method table in for
24 hours. This speeds up the creation of API
objects.
objects.
log - An callable that accepts a string parameter.
Receives log messages. No logging is done if
this is None.
......@@ -227,9 +210,9 @@ class API(object):
Only one of api_key and key_file may be passed.
If method_cache is explicitly set to None, no method table
caching is performed. If the parameter is not passed, a file in
$HOME/.etsy is used if that directory exists. Otherwise, a
temp file is used.
caching is performed. If the parameter is not passed, a file in
$HOME/.etsy is used if that directory exists. Otherwise, a
temp file is used.
"""
if not getattr(self, 'api_url', None):
raise AssertionError('No api_url configured.')
......@@ -244,10 +227,11 @@ class API(object):
raise AssertionError('Keys can be read from a file or passed, '
'but not both.')
if api_key:
self.api_key = api_key
else:
self.api_key = self._read_key(key_file)
if self.etsy_oauth_client is None:
if api_key:
self.api_key = api_key
else:
self.api_key = self._read_key(key_file)
self.log = log or self._ignore
if not callable(self.log):
......@@ -258,15 +242,12 @@ class API(object):
self.decode = json.loads
self.log('Creating %s Etsy API, base url=%s.' % (
self.api_version, self.api_url))
self.api_version, self.api_url))
self._get_methods(method_cache)
def _ignore(self, _):
pass
def _get_methods(self, method_cache):
self.method_cache = MethodTableCache(self, method_cache)
ms = self.method_cache.get()
......@@ -277,15 +258,12 @@ class API(object):
# self.log('API._get_methods: self._methods = %r' % self._methods)
def etsy_home(self):
return os.path.expanduser('~/.etsy')
def get_method_table(self):
return self._get('GET', '/')
def _read_key(self, key_file):
key_file = key_file or os.path.join(self.etsy_home(), 'keys')
if not os.path.isfile(key_file):
......@@ -294,22 +272,21 @@ class API(object):
'pass an API key explicitly.' % key_file)
gs = {}
execfile(key_file, gs)
execfile(key_file, gs) # noqa
return gs[self.api_version]
def _get_url(self, url, http_method, content_type, body):
self.log("API._get_url: url = %r" % url)
with closing(urllib2.urlopen(url)) as f:
return f.read()
return f.read()
def _get(self, http_method, url, **kwargs):
kwargs.update(dict(api_key=self.api_key))
if self.etsy_oauth_client is None:
kwargs.update(dict(api_key=self.api_key))
if http_method == 'GET':
url = '%s%s?%s' % (self.api_url, url, urlencode(kwargs))
body = None
body = ''
content_type = None
elif http_method == 'POST':
url = '%s%s' % (self.api_url, url)
......@@ -327,13 +304,14 @@ class API(object):
self.last_url = url
data = self._get_url(url, http_method, content_type, body)
self.log('API._get: http_method = %r, url = %r, data = %r' % (http_method, url, data))
self.log('API._get: http_method = %r, url = %r, data = %r' %
(http_method, url, data))
try:
self.data = self.decode(data)
except json.JSONDecodeError:
raise ValueError('Could not decode response from Etsy as JSON: %r' % data)
raise ValueError(
'Could not decode response from Etsy as JSON: %r' % data)
self.count = self.data['count']
return self.data['results']
......@@ -6,10 +6,12 @@ Functions for encoding multipart/form-data
From http://code.activestate.com/recipes/146306/ (PSF License)
"""
def encode_multipart_formdata(fields, files):
"""
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
files is a sequence of (name, filename, value) elements for data to be
uploaded as files
Return (content_type, body) ready for httplib.HTTP instance
"""
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
......@@ -22,7 +24,9 @@ def encode_multipart_formdata(fields, files):
L.append(value)
for (key, filename, value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
L.append(
'Content-Disposition: '
'form-data; name="%s"; filename="%s"' % (key, filename))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(value)
......@@ -32,6 +36,6 @@ def encode_multipart_formdata(fields, files):
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
import urllib
import urllib # noqa
from _core import API, missing
from etsy_env import EtsyEnvSandbox, EtsyEnvProduction
from etsy_env import EtsyEnvProduction
try:
from urlparse import parse_qsl
from urlparse import parse_qsl # noqa
except ImportError:
from cgi import parse_qsl
from cgi import parse_qsl # noqa
class EtsyV2(API):
api_version = 'v2'
def __init__(self, api_key='', key_file=None, method_cache=missing,
etsy_env=EtsyEnvSandbox(), log=None, etsy_oauth_client=None):
def __init__(self, api_key='', key_file=None, method_cache=missing,
etsy_env=EtsyEnvProduction(), log=None,
etsy_oauth_client=None):
self.api_url = etsy_env.api_url
self.etsy_oauth_client = None
......@@ -22,5 +24,8 @@ class EtsyV2(API):
def _get_url(self, url, http_method, content_type, body):
if self.etsy_oauth_client is not None:
return self.etsy_oauth_client.do_oauth_request(url, http_method, content_type, body)
return self.etsy_oauth_client.do_oauth_request(url,
http_method,
content_type,
body)
return API._get_url(self, url, http_method, content_type, body)
class EtsyEnvSandbox(object):
request_token_url = 'http://sandbox.openapi.etsy.com/v2/oauth/request_token'
access_token_url = 'http://sandbox.openapi.etsy.com/v2/oauth/access_token'
request_token_url = \
'https://sandbox.openapi.etsy.com/v2/oauth/request_token'
access_token_url = 'https://sandbox.openapi.etsy.com/v2/oauth/access_token'
signin_url = 'https://www.etsy.com/oauth/signin'
api_url = 'http://sandbox.openapi.etsy.com/v2'
api_url = 'https://sandbox.openapi.etsy.com/v2'
class EtsyEnvProduction(object):
request_token_url = 'http://openapi.etsy.com/v2/oauth/request_token'
access_token_url = 'http://openapi.etsy.com/v2/oauth/access_token'
request_token_url = 'https://openapi.etsy.com/v2/oauth/request_token'
access_token_url = 'https://openapi.etsy.com/v2/oauth/access_token'
signin_url = 'https://www.etsy.com/oauth/signin'
api_url = 'http://openapi.etsy.com/v2'
api_url = 'https://openapi.etsy.com/v2'
{
"getMethodTable": {
"name": "getMethodTable",
"description": "Get a list of all methods available.",
"uri": "/",
"params": null,
"defaults": null,
"type": "ApiMethod",
"visibility": "public",
"http_method": "GET"
},
"getCategory": {
"name": "getCategory",
"description": "Retrieves a top-level Category by tag.",
"uri": "/categories/:tag",
"params": {
"tag": "string"
},
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"getSubCategory": {
"name": "getSubCategory",
"description": "Retrieves a second-level Category by tag and subtag.",
"uri": "/categories/:tag/:subtag",
"params": {
"tag": "string",
"subtag": "string"
},
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"getSubSubCategory": {
"name": "getSubSubCategory",
"description": "Retrieves a third-level Category by tag, subtag and subsubtag.",
"uri": "/categories/:tag/:subtag/:subsubtag",
"params": {
"tag": "string",
"subtag": "string",
"subsubtag": "string"
},
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"findAllCountry": {
"name": "findAllCountry",
"description": "Finds all Country.",
"uri": "/countries",
"params": null,
"defaults": null,
"type": "Country",
"visibility": "public",
"http_method": "GET"
},
"getCountry": {
"name": "getCountry",
"description": "Retrieves a Country by id.",
"uri": "/countries/:country_id",
"params": {
"country_id": "array(int)"
},
"defaults": null,
"type": "Country",
"visibility": "public",
"http_method": "GET"
},
"findAllFeaturedTreasuries": {
"name": "findAllFeaturedTreasuries",
"description": "Finds all FeaturedTreasuries.",
"uri": "/featured_treasuries",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"region": "region"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"region": "__ALL_REGIONS__"
},
"type": "FeaturedTreasury",
"visibility": "public",
"http_method": "GET"
},
"getFeaturedTreasuryById": {
"name": "getFeaturedTreasuryById",
"description": "Finds FeaturedTreasury by numeric ID.",
"uri": "/featured_treasuries/:featured_treasury_id",
"params": {
"featured_treasury_id": "int"
},
"defaults": null,
"type": "FeaturedTreasury",
"visibility": "public",
"http_method": "GET"
},
"findAllListingsForFeaturedTreasuryId": {
"name": "findAllListingsForFeaturedTreasuryId",
"description": "Finds all listings for a certain FeaturedTreasury.",
"uri": "/featured_treasuries/:featured_treasury_id/listings",
"params": {
"featured_treasury_id": "int"
},
"defaults": null,
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllListingTransactions": {
"name": "findAllListingTransactions",
"description": "Finds all listings for a certain FeaturedTreasury.",
"uri": "/listings/:listing_id/transactions",
"params": {
"listing_id": "int"
},
"defaults": null,
"type": "Transaction",
"visibility": "private",
"http_method": "GET"
},
"findAllActiveListingsForFeaturedTreasuryId": {
"name": "findAllActiveListingsForFeaturedTreasuryId",
"description": "Finds all active listings for a certain FeaturedTreasury.",
"uri": "/featured_treasuries/:featured_treasury_id/listings/active",
"params": {
"featured_treasury_id": "int"
},
"defaults": null,
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllFeaturedListings": {
"name": "findAllFeaturedListings",
"description": "Finds all FeaturedTreasury listings.",
"uri": "/featured_treasuries/listings",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"region": "region"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"region": "__ALL_REGIONS__"
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllCurrentFeaturedListings": {
"name": "findAllCurrentFeaturedListings",
"description": "Finds FeaturedTreasury listings that are currently displayed on a regional homepage.",
"uri": "/featured_treasuries/listings/homepage_current",
"params": {
"region": "region"
},
"defaults": {
"region": "US"
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllFeaturedTreasuriesByOwner": {
"name": "findAllFeaturedTreasuriesByOwner",
"description": "Finds all FeaturedTreasury by numeric owner_id.",
"uri": "/featured_treasuries/owner/:owner_id",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"owner_id": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "FeaturedTreasury",
"visibility": "public",
"http_method": "GET"
},
"getGuest": {
"name": "getGuest",
"description": "Get a guest by ID.",
"uri": "/guests/:guest_id",
"params": {
"guest_id": "guest_id"
},
"defaults": null,
"type": "Guest",
"visibility": "public",
"http_method": "GET"
},
"findAllGuestCarts": {
"name": "findAllGuestCarts",
"description": "Get all guest's carts",
"uri": "/guests/:guest_id/carts",
"params": {
"guest_id": "guest_id"
},
"defaults": null,
"type": "GuestCart",
"visibility": "public",
"http_method": "GET"
},
"addToGuestCart": {
"name": "addToGuestCart",
"description": "Add a listing to guest's cart",
"uri": "/guests/:guest_id/carts",
"params": {
"guest_id": "guest_id",
"listing_id": "int",
"quantity": "int",
"selected_variations": "map(int, int)"
},
"defaults": {
"quantity": 1,
"selected_variations": null
},
"type": "GuestCart",
"visibility": "public",
"http_method": "POST"
},
"updateGuestCartListingQuantity": {
"name": "updateGuestCartListingQuantity",
"description": "Update a guest's cart listing purchase quantity",
"uri": "/guests/:guest_id/carts",
"params": {
"guest_id": "guest_id",
"listing_id": "int",
"quantity": "int",
"listing_customization_id": "int"
},
"defaults": {
"listing_customization_id": 0
},
"type": "GuestCart",
"visibility": "public",
"http_method": "PUT"
},
"removeGuestCartListing": {
"name": "removeGuestCartListing",
"description": "Remove a listing from a guest's cart",
"uri": "/guests/:guest_id/carts",
"params": {
"guest_id": "guest_id",
"listing_id": "int",
"listing_customization_id": "int"
},
"defaults": {
"listing_customization_id": 0
},
"type": "GuestCart",
"visibility": "public",
"http_method": "DELETE"
},
"findGuestCart": {
"name": "findGuestCart",
"description": "Get a guest's cart",
"uri": "/guests/:guest_id/carts/:cart_id",
"params": {
"guest_id": "guest_id",
"cart_id": "cart_id"
},
"defaults": null,
"type": "GuestCart",
"visibility": "public",
"http_method": "GET"
},
"updateGuestCart": {
"name": "updateGuestCart",
"description": "Update a guest's cart",
"uri": "/guests/:guest_id/carts/:cart_id",
"params": {
"guest_id": "guest_id",
"cart_id": "cart_id",
"destination_country_id": "int",
"message_to_seller": "string",
"coupon_code": "string"
},
"defaults": {
"destination_country_id": null,
"message_to_seller": null,
"coupon_code": null
},
"type": "GuestCart",
"visibility": "public",
"http_method": "PUT"
},
"deleteGuestCart": {
"name": "deleteGuestCart",
"description": "Delete a guest's cart",
"uri": "/guests/:guest_id/carts/:cart_id",
"params": {
"guest_id": "guest_id",
"cart_id": "cart_id"
},
"defaults": null,
"type": "GuestCart",
"visibility": "public",
"http_method": "DELETE"
},
"claimGuest": {
"name": "claimGuest",
"description": "Claim this guest to the associated user. Merges the GuestCart's associated with this GuestId into the logged in User's Carts. Returns the number of listings merged in meta['listings_merged'].",
"uri": "/guests/:guest_id/claim",
"params": {
"guest_id": "guest_id"
},
"defaults": null,
"type": "Guest",
"visibility": "private",
"http_method": "POST"
},
"generateGuest": {
"name": "generateGuest",
"description": "A helper method that generates a Guest ID to associate to this anonymous session. This method is not strictly necessary, as any sufficiently random guest ID that is 13 characters in length will suffice and automatically create a guest account on use if it does not yet exist.",
"uri": "/guests/generator",
"params": null,
"defaults": null,
"type": "Guest",
"visibility": "public",
"http_method": "GET"
},
"listImageTypes": {
"name": "listImageTypes",
"description": "Lists available image types along with their supported sizes.",
"uri": "/image_types",
"params": null,
"defaults": null,
"type": "ImageType",
"visibility": "public",
"http_method": "GET"
},
"createListing": {
"name": "createListing",
"description": "Creates a new Listing. NOTE: A shipping_template_id is required when creating a listing. <strong>NOTE: All listings created on www.etsy.com must be actual items for sale. Creating active test or otherwise unreal listings may lead to your shop being frozen. Please use the API Sandbox for all test listing creation.</strong>",
"uri": "/listings",
"params": {
"quantity": "int",
"title": "string",
"description": "text",
"price": "float",
"materials": "array(string)",
"shipping_template_id": "int",
"shop_section_id": "int",
"image_ids": "array(int)",
"non_taxable": "boolean",
"is_private": "boolean",
"image": "imagefile",
"state": "enum(active, draft)",
"processing_min": "int",
"processing_max": "int",
"category_id": "int",
"tags": "array(string)",
"who_made": "enum(i_did, collective, someone_else)",
"is_supply": "boolean",
"when_made": "enum(made_to_order, 2010_2015, 2000_2009, 1994_1999, before_1994, 1990_1993, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)",
"recipient": "enum(men, women, unisex_adults, teen_boys, teen_girls, teens, boys, girls, children, baby_boys, baby_girls, babies, birds, cats, dogs, pets)",
"occasion": "enum(anniversary, baptism, bar_or_bat_mitzvah, birthday, canada_day, chinese_new_year, cinco_de_mayo, confirmation, christmas, day_of_the_dead, easter, eid, engagement, fathers_day, get_well, graduation, halloween, hanukkah, housewarming, kwanza, prom, july_4th, mothers_day, new_baby, new_years, quinceanera, retirement, st_patricks_day, sweet_16, sympathy, thanksgiving, valentines, wedding)",
"style": "array(string)"
},
"defaults": {
"materials": null,
"shop_section_id": null,
"image_ids": null,
"non_taxable": null,
"image": null,
"state": "active",
"shipping_template_id": null,
"processing_min": null,
"processing_max": null,
"tags": null,
"recipient": null,
"occasion": null,
"style": null
},
"type": "Listing",
"visibility": "private",
"http_method": "POST"
},
"getListing": {
"name": "getListing",
"description": "Retrieves a Listing by id.",
"uri": "/listings/:listing_id",
"params": {
"listing_id": "array(int)"
},
"defaults": null,
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"updateListing": {
"name": "updateListing",
"description": "Updates a Listing",
"uri": "/listings/:listing_id",
"params": {
"listing_id": "int",
"quantity": "int",
"title": "string",
"description": "text",
"price": "float",
"materials": "array(string)",
"renew": "boolean",
"shipping_template_id": "int",
"shop_section_id": "int",
"state": "enum(active, inactive, draft)",
"image_ids": "array(int)",
"non_taxable": "boolean",
"is_private": "boolean",
"category_id": "int",
"tags": "array(string)",
"who_made": "enum(i_did, collective, someone_else)",
"is_supply": "boolean",
"when_made": "enum(made_to_order, 2010_2015, 2000_2009, 1994_1999, before_1994, 1990_1993, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)",
"recipient": "enum(men, women, unisex_adults, teen_boys, teen_girls, teens, boys, girls, children, baby_boys, baby_girls, babies, birds, cats, dogs, pets)",
"occasion": "enum(anniversary, baptism, bar_or_bat_mitzvah, birthday, canada_day, chinese_new_year, cinco_de_mayo, confirmation, christmas, day_of_the_dead, easter, eid, engagement, fathers_day, get_well, graduation, halloween, hanukkah, housewarming, kwanza, prom, july_4th, mothers_day, new_baby, new_years, quinceanera, retirement, st_patricks_day, sweet_16, sympathy, thanksgiving, valentines, wedding)",
"style": "array(string)",
"processing_min": "int",
"processing_max": "int"
},
"defaults": {
"quantity": null,
"title": null,
"description": null,
"price": null,
"materials": null,
"renew": null,
"shipping_template_id": null,
"shop_section_id": null,
"state": "active",
"image_ids": null,
"non_taxable": null,
"category_id": null,
"tags": null,
"who_made": null,
"is_supply": null,
"when_made": null,
"recipient": null,
"occasion": null,
"style": null,
"processing_min": null,
"processing_max": null
},
"type": "Listing",
"visibility": "private",
"http_method": "PUT"
},
"deleteListing": {
"name": "deleteListing",
"description": "Deletes a Listing",
"uri": "/listings/:listing_id",
"params": {
"listing_id": "int"
},
"defaults": null,
"type": "Listing",
"visibility": "private",
"http_method": "DELETE"
},
"findAllListingFavoredBy": {
"name": "findAllListingFavoredBy",
"description": "Retrieves a set of FavoriteListing objects associated to a Listing.",
"uri": "/listings/:listing_id/favored-by",
"params": {
"listing_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "FavoriteListing",
"visibility": "public",
"http_method": "GET"
},
"findAllListingFiles": {
"name": "findAllListingFiles",
"description": "Finds all ListingFiles on a Listing",
"uri": "/listings/:listing_id/files",
"params": {
"listing_id": "int"
},
"defaults": null,
"type": "ListingFile",
"visibility": "private",
"http_method": "GET"
},
"uploadListingFile": {
"name": "uploadListingFile",
"description": "Upload a new listing file, or attach an existing file to this listing. You must either provide the listing_file_id\nof an existing listing file, or the name and file data of a new file that you are uploading. If you are attaching\na file to a listing that is currently not digital, the listing will be converted to a digital listing. This will\ncause the listing to have free shipping and will remove any variations.",
"uri": "/listings/:listing_id/files",
"params": {
"listing_id": "int",
"listing_file_id": "int",
"file": "imagefile",
"name": "string",
"rank": "int"
},
"defaults": {
"listing_file_id": null,
"file": null,
"name": null,
"rank": 1
},
"type": "ListingFile",
"visibility": "private",
"http_method": "POST"
},
"findListingFile": {
"name": "findListingFile",
"description": "Finds a ListingFile by ID",
"uri": "/listings/:listing_id/files/:listing_file_id",
"params": {
"listing_id": "int",
"listing_file_id": "int"
},
"defaults": null,
"type": "ListingFile",
"visibility": "private",
"http_method": "GET"
},
"deleteListingFile": {
"name": "deleteListingFile",
"description": "Removes the listing file from this listing. If this is the last file on a listing, the listing will no longer\nbe considered a digital listing.",
"uri": "/listings/:listing_id/files/:listing_file_id",
"params": {
"listing_id": "int",
"listing_file_id": "int"
},
"defaults": null,
"type": "ListingFile",
"visibility": "private",
"http_method": "DELETE"
},
"findAllListingImages": {
"name": "findAllListingImages",
"description": "Retrieves a set of ListingImage objects associated to a Listing.",
"uri": "/listings/:listing_id/images",
"params": {
"listing_id": "int"
},
"defaults": null,
"type": "ListingImage",
"visibility": "public",
"http_method": "GET"
},
"uploadListingImage": {
"name": "uploadListingImage",
"description": "Upload a new listing image, or re-associate a previously deleted one. You may associate an image\n to any listing within the same shop that the image's original listing belongs to.\n You MUST pass either a listing_image_id OR an image to this method.\n Passing a listing_image_id serves to re-associate an image that was previously deleted.\n If you wish to re-associate an image, we strongly recommend using the listing_image_id\n argument as opposed to re-uploading a new image each time, to save bandwidth for you as well as us.\n Pass overwrite=1 to replace the existing image at a given rank.",
"uri": "/listings/:listing_id/images",
"params": {
"listing_id": "int",
"listing_image_id": "int",
"image": "imagefile",
"rank": "int",
"overwrite": "boolean"
},
"defaults": {
"listing_image_id": null,
"image": null,
"rank": 1,
"overwrite": 0
},
"type": "ListingImage",
"visibility": "private",
"http_method": "POST"
},
"getImage_Listing": {
"name": "getImage_Listing",
"description": "Retrieves a Image_Listing by id.",
"uri": "/listings/:listing_id/images/:listing_image_id",
"params": {
"listing_image_id": "array(int)",
"listing_id": "int"
},
"defaults": null,
"type": "ListingImage",
"visibility": "public",
"http_method": "GET"
},
"deleteListingImage": {
"name": "deleteListingImage",
"description": "Deletes a listing image. A copy of the file remains on our servers,\n and so a deleted image may be re-associated with the listing without\n re-uploading the original image; see uploadListingImage",
"uri": "/listings/:listing_id/images/:listing_image_id",
"params": {
"listing_id": "int",
"listing_image_id": "int"
},
"defaults": null,
"type": "ListingImage",
"visibility": "private",
"http_method": "DELETE"
},
"findAllListingShippingProfileEntries": {
"name": "findAllListingShippingProfileEntries",
"description": "Retrieves a set of ShippingInfo objects associated to a Listing.",
"uri": "/listings/:listing_id/shipping/info",
"params": {
"listing_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "ShippingInfo",
"visibility": "public",
"http_method": "GET"
},
"createShippingInfo": {
"name": "createShippingInfo",
"description": "Creates a new ShippingInfo.",
"uri": "/listings/:listing_id/shipping/info",
"params": {
"origin_country_id": "int",
"destination_country_id": "int",
"primary_cost": "float",
"secondary_cost": "float",
"region_id": "int",
"listing_id": "int"
},
"defaults": {
"destination_country_id": null,
"region_id": null
},
"type": "ShippingInfo",
"visibility": "private",
"http_method": "POST"
},
"getListingTranslation": {
"name": "getListingTranslation",
"description": "Retrieves a ListingTranslation by listing_id and language",
"uri": "/listings/:listing_id/translations/:language",
"params": {
"listing_id": "int",
"language": "language"
},
"defaults": null,
"type": "ListingTranslation",
"visibility": "public",
"http_method": "GET"
},
"createListingTranslation": {
"name": "createListingTranslation",
"description": "Creates a ListingTranslation by listing_id and language",
"uri": "/listings/:listing_id/translations/:language",
"params": {
"listing_id": "int",
"language": "language"
},
"defaults": null,
"type": "ListingTranslation",
"visibility": "private",
"http_method": "POST"
},
"updateListingTranslation": {
"name": "updateListingTranslation",
"description": "Updates a ListingTranslation by listing_id and language",
"uri": "/listings/:listing_id/translations/:language",
"params": {
"listing_id": "int",
"language": "language"
},
"defaults": null,
"type": "ListingTranslation",
"visibility": "private",
"http_method": "PUT"
},
"deleteListingTranslation": {
"name": "deleteListingTranslation",
"description": "Deletes a ListingTranslation by listing_id and language",
"uri": "/listings/:listing_id/translations/:language",
"params": {
"listing_id": "int",
"language": "language"
},
"defaults": null,
"type": "ListingTranslation",
"visibility": "private",
"http_method": "DELETE"
},
"getListingVariations": {
"name": "getListingVariations",
"description": "Get the listing variations available for a listing.",
"uri": "/listings/:listing_id/variations",
"params": {
"listing_id": "int"
},
"defaults": null,
"type": "Variations_Property",
"visibility": "private",
"http_method": "GET"
},
"createListingVariations": {
"name": "createListingVariations",
"description": "Update all of the listing variations available for a listing; optionally set custom property names and property qualifiers. Expects a JSON array with a collection of objects of the form: <code>[{\"property_id\":200, \"value\":\"Black\"}, {\"property_id\":200, \"value\":\"White\"}]</code>",
"uri": "/listings/:listing_id/variations",
"params": {
"listing_id": "int",
"variations": "array(listing_variation)",
"custom_property_names": "map(int, string)",
"recipient_id": "int",
"sizing_scale": "int",
"weight_scale": "int",
"height_scale": "int",
"length_scale": "int",
"width_scale": "int",
"diameter_scale": "int",
"dimensions_scale": "int"
},
"defaults": {
"custom_property_names": null,
"recipient_id": null,
"sizing_scale": null,
"weight_scale": null,
"height_scale": null,
"length_scale": null,
"width_scale": null,
"diameter_scale": null,
"dimensions_scale": null
},
"type": "Variations_Property",
"visibility": "private",
"http_method": "POST"
},
"createListingVariation": {
"name": "createListingVariation",
"description": "Add a new listing variation for a listing.",
"uri": "/listings/:listing_id/variations/:property_id",
"params": {
"listing_id": "int",
"property_id": "int",
"value": "string",
"is_available": "boolean",
"price": "int"
},
"defaults": {
"is_available": true,
"price": null
},
"type": "Variations_Property",
"visibility": "private",
"http_method": "POST"
},
"updateListingVariation": {
"name": "updateListingVariation",
"description": "Update a listing variation for a listing.",
"uri": "/listings/:listing_id/variations/:property_id",
"params": {
"listing_id": "int",
"property_id": "int",
"value": "string",
"is_available": "boolean",
"price": "int"
},
"defaults": {
"price": null
},
"type": "Variations_Property",
"visibility": "private",
"http_method": "PUT"
},
"deleteListingVariation": {
"name": "deleteListingVariation",
"description": "Remove a listing variation for a listing.",
"uri": "/listings/:listing_id/variations/:property_id",
"params": {
"listing_id": "int",
"property_id": "int",
"value": "string"
},
"defaults": null,
"type": "Variations_Property",
"visibility": "private",
"http_method": "DELETE"
},
"findAllListingActive": {
"name": "findAllListingActive",
"description": "Finds all active Listings. (Note: the sort_on and sort_order options only work when combined with one of the search options: keywords, color, tags, location, etc.)",
"uri": "/listings/active",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"keywords": "text",
"sort_on": "enum(created, price, score)",
"sort_order": "enum(up, down)",
"min_price": "float",
"max_price": "float",
"color": "color_triplet",
"color_accuracy": "color_wiggle",
"tags": "array(string)",
"category": "category",
"location": "string",
"lat": "latitude",
"lon": "longitude",
"geo_level": "enum(city, state, country)",
"accepts_gift_cards": "boolean",
"translate_keywords": "boolean"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"keywords": null,
"sort_on": "created",
"sort_order": "down",
"min_price": null,
"max_price": null,
"color": null,
"color_accuracy": 0,
"tags": null,
"category": null,
"location": null,
"lat": null,
"lon": null,
"geo_level": "city",
"accepts_gift_cards": "false",
"translate_keywords": "false"
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"getOrder": {
"name": "getOrder",
"description": "Retrieves a Order by id.",
"uri": "/orders/:order_id",
"params": {
"order_id": "array(int)"
},
"defaults": null,
"type": "Order",
"visibility": "private",
"http_method": "GET"
},
"findAllOrderReceipts": {
"name": "findAllOrderReceipts",
"description": "Retrieves a set of Receipt objects associated to a Order.",
"uri": "/orders/:order_id/receipts",
"params": {
"order_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Receipt",
"visibility": "private",
"http_method": "GET"
},
"findPayment": {
"name": "findPayment",
"description": "Get a Direct Checkout Payment",
"uri": "/payments/:payment_id",
"params": {
"payment_id": "array(int)"
},
"defaults": null,
"type": "Payment",
"visibility": "private",
"http_method": "GET"
},
"findPaymentAdjustments": {
"name": "findPaymentAdjustments",
"description": "Get a Payment Adjustments from a Payment Id",
"uri": "/payments/:payment_id/adjustments",
"params": {
"payment_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "PaymentAdjustment",
"visibility": "private",
"http_method": "GET"
},
"findPaymentAdjustment": {
"name": "findPaymentAdjustment",
"description": "Get a Direct Checkout Payment Adjustment",
"uri": "/payments/:payment_id/adjustments/:payment_adjustment_id",
"params": {
"payment_id": "int",
"payment_adjustment_id": "int"
},
"defaults": null,
"type": "PaymentAdjustment",
"visibility": "private",
"http_method": "GET"
},
"findPaymentAdjustmentItem": {
"name": "findPaymentAdjustmentItem",
"description": "Get a Direct Checkout Payment Adjustment Item",
"uri": "/payments/:payment_id/adjustments/:payment_adjustment_id/items/:payment_adjustment_item_id",
"params": {
"payment_id": "int",
"payment_adjustment_id": "int",
"payment_adjustment_item_id": "int"
},
"defaults": null,
"type": "PaymentAdjustmentItem",
"visibility": "private",
"http_method": "GET"
},
"createPaymentTemplate": {
"name": "createPaymentTemplate",
"description": "Creates a new PaymentTemplate.",
"uri": "/payments/templates",
"params": {
"allow_check": "boolean",
"allow_mo": "boolean",
"allow_other": "boolean",
"allow_paypal": "boolean",
"allow_cc": "boolean",
"paypal_email": "string",
"name": "string",
"first_line": "string",
"second_line": "string",
"city": "string",
"state": "string",
"zip": "string",
"country_id": "int"
},
"defaults": {
"allow_check": null,
"allow_mo": null,
"allow_other": null,
"allow_paypal": null,
"allow_cc": null,
"paypal_email": null,
"name": null,
"first_line": null,
"second_line": null,
"city": null,
"state": null,
"zip": null,
"country_id": null
},
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "POST"
},
"getPaymentTemplate": {
"name": "getPaymentTemplate",
"description": "Retrieves a PaymentTemplate by id.",
"uri": "/payments/templates/:payment_template_id",
"params": {
"payment_template_id": "array(int)"
},
"defaults": null,
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "GET"
},
"updatePaymentTemplate": {
"name": "updatePaymentTemplate",
"description": "Updates a PaymentTemplate.",
"uri": "/payments/templates/:payment_template_id",
"params": {
"allow_check": "boolean",
"allow_mo": "boolean",
"allow_other": "boolean",
"allow_paypal": "boolean",
"allow_cc": "boolean",
"paypal_email": "string",
"name": "string",
"first_line": "string",
"second_line": "string",
"city": "string",
"state": "string",
"zip": "string",
"country_id": "int",
"payment_template_id": "int"
},
"defaults": {
"allow_check": null,
"allow_mo": null,
"allow_other": null,
"allow_paypal": null,
"allow_cc": null,
"paypal_email": null,
"name": null,
"first_line": null,
"second_line": null,
"city": null,
"state": null,
"zip": null,
"country_id": null
},
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "PUT"
},
"getPropertyOptionModifier": {
"name": "getPropertyOptionModifier",
"description": "Add a value for a given property.",
"uri": "/property_options/modifiers",
"params": {
"property_id": "int",
"category_id": "int",
"recipient_id": "int",
"sizing_scale": "int",
"weight_scale": "int",
"height_scale": "int",
"length_scale": "int",
"width_scale": "int",
"diameter_scale": "int",
"dimensions_scale": "int"
},
"defaults": {
"category_id": null,
"recipient_id": null,
"sizing_scale": null,
"weight_scale": null,
"height_scale": null,
"length_scale": null,
"width_scale": null,
"diameter_scale": null,
"dimensions_scale": null
},
"type": "Variations_PropertySetOptionModifier",
"visibility": "public",
"http_method": "GET"
},
"findAllSuggestedPropertyOptions": {
"name": "findAllSuggestedPropertyOptions",
"description": "Finds all suggested property options for a given property.",
"uri": "/property_options/suggested",
"params": {
"property_id": "int",
"category_id": "int",
"recipient_id": "int",
"sizing_scale": "int",
"weight_scale": "int",
"height_scale": "int",
"length_scale": "int",
"width_scale": "int",
"diameter_scale": "int",
"dimensions_scale": "int"
},
"defaults": {
"category_id": null,
"recipient_id": null,
"sizing_scale": null,
"weight_scale": null,
"height_scale": null,
"length_scale": null,
"width_scale": null,
"diameter_scale": null,
"dimensions_scale": null
},
"type": "Variations_PropertySetOption",
"visibility": "public",
"http_method": "GET"
},
"findPropertySet": {
"name": "findPropertySet",
"description": "Find the property set for the category id",
"uri": "/property_sets",
"params": {
"category_id": "int"
},
"defaults": {
"category_id": null
},
"type": "Variations_PropertySet",
"visibility": "public",
"http_method": "GET"
},
"createReceiptOnSandbox": {
"name": "createReceiptOnSandbox",
"description": "Creates a purchase for the current OAuth user, including Order, Receipt and Transaction resources. This method is only available via the Sandbox API. Listing IDs must be active, and belong to the same seller user ID. The buyer must have at least one UserAddress record, or an error will be thrown.",
"uri": "/receipts",
"params": {
"listing_id": "array(int)"
},
"defaults": null,
"type": "Receipt",
"visibility": "private",
"http_method": "POST"
},
"getReceipt": {
"name": "getReceipt",
"description": "Retrieves a Receipt by id.",
"uri": "/receipts/:receipt_id",
"params": {
"receipt_id": "array(int)"
},
"defaults": null,
"type": "Receipt",
"visibility": "private",
"http_method": "GET"
},
"updateReceipt": {
"name": "updateReceipt",
"description": "Updates a Receipt",
"uri": "/receipts/:receipt_id",
"params": {
"receipt_id": "int",
"was_paid": "boolean",
"was_shipped": "boolean",
"message_from_seller": "string",
"message_from_buyer": "string"
},
"defaults": {
"was_paid": null,
"was_shipped": null,
"message_from_seller": null,
"message_from_buyer": null
},
"type": "Receipt",
"visibility": "private",
"http_method": "PUT"
},
"findAllReceiptListings": {
"name": "findAllReceiptListings",
"description": "Finds all listings in a receipt",
"uri": "/receipts/:receipt_id/listings",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"receipt_id": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"findAllReceiptTransactions": {
"name": "findAllReceiptTransactions",
"description": "Retrieves a set of Transaction objects associated to a Receipt.",
"uri": "/receipts/:receipt_id/transactions",
"params": {
"receipt_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Transaction",
"visibility": "private",
"http_method": "GET"
},
"findAllRegion": {
"name": "findAllRegion",
"description": "Finds all Region.",
"uri": "/regions",
"params": null,
"defaults": null,
"type": "Region",
"visibility": "public",
"http_method": "GET"
},
"getRegion": {
"name": "getRegion",
"description": "Retrieves a Region by id.",
"uri": "/regions/:region_id",
"params": {
"region_id": "array(int)"
},
"defaults": null,
"type": "Region",
"visibility": "public",
"http_method": "GET"
},
"findBrowseSegments": {
"name": "findBrowseSegments",
"description": "Find all Browse Segments",
"uri": "/segments",
"params": {
"region": "string",
"path": "string"
},
"defaults": {
"region": "US",
"path": ""
},
"type": "Segment",
"visibility": "public",
"http_method": "GET"
},
"findBrowseSegmentListings": {
"name": "findBrowseSegmentListings",
"description": "Find Listings for a Segment by Segment path",
"uri": "/segments/listings",
"params": {
"path": "string",
"limit": "int",
"offset": "int",
"page": "int",
"keywords": "text",
"sort_on": "enum(created, price, score)",
"sort_order": "enum(up, down)",
"min_price": "float",
"max_price": "float",
"location": "string",
"lat": "latitude",
"lon": "longitude",
"geo_level": "enum(city, state, country)",
"accepts_gift_cards": "boolean"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"keywords": null,
"sort_on": "created",
"sort_order": "down",
"min_price": null,
"max_price": null,
"location": null,
"lat": null,
"lon": null,
"geo_level": "city",
"accepts_gift_cards": "false"
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findBrowseSegmentPosters": {
"name": "findBrowseSegmentPosters",
"description": "Find Browse SegmentPosters by Segment slug",
"uri": "/segments/posters",
"params": {
"path": "string"
},
"defaults": {
"path": ""
},
"type": "SegmentPoster",
"visibility": "public",
"http_method": "GET"
},
"getServerEpoch": {
"name": "getServerEpoch",
"description": "Get server time, in epoch seconds notation.",
"uri": "/server/epoch",
"params": null,
"defaults": null,
"type": "Int",
"visibility": "public",
"http_method": "GET"
},
"ping": {
"name": "ping",
"description": "Check that the server is alive.",
"uri": "/server/ping",
"params": null,
"defaults": null,
"type": "String",
"visibility": "public",
"http_method": "GET"
},
"getShippingInfo": {
"name": "getShippingInfo",
"description": "Retrieves a ShippingInfo by id.",
"uri": "/shipping/info/:shipping_info_id",
"params": {
"shipping_info_id": "array(int)"
},
"defaults": null,
"type": "ShippingInfo",
"visibility": "private",
"http_method": "GET"
},
"updateShippingInfo": {
"name": "updateShippingInfo",
"description": "Updates a ShippingInfo with the given id.",
"uri": "/shipping/info/:shipping_info_id",
"params": {
"shipping_info_id": "int",
"origin_country_id": "int",
"destination_country_id": "int",
"primary_cost": "float",
"secondary_cost": "float",
"region_id": "int",
"listing_id": "int"
},
"defaults": {
"origin_country_id": null,
"destination_country_id": null,
"primary_cost": null,
"secondary_cost": null,
"region_id": null,
"listing_id": null
},
"type": "ShippingInfo",
"visibility": "private",
"http_method": "PUT"
},
"deleteShippingInfo": {
"name": "deleteShippingInfo",
"description": "Deletes the ShippingInfo with the given id.",
"uri": "/shipping/info/:shipping_info_id",
"params": {
"shipping_info_id": "int"
},
"defaults": null,
"type": "ShippingProfileEntry",
"visibility": "private",
"http_method": "DELETE"
},
"createShippingTemplate": {
"name": "createShippingTemplate",
"description": "Creates a new ShippingTemplate",
"uri": "/shipping/templates",
"params": {
"title": "string",
"origin_country_id": "int",
"destination_country_id": "int",
"primary_cost": "float",
"secondary_cost": "float",
"destination_region_id": "int"
},
"defaults": {
"destination_country_id": null,
"destination_region_id": null
},
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "POST"
},
"getShippingTemplate": {
"name": "getShippingTemplate",
"description": "Retrieves a ShippingTemplate by id.",
"uri": "/shipping/templates/:shipping_template_id",
"params": {
"shipping_template_id": "array(int)"
},
"defaults": null,
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "GET"
},
"updateShippingTemplate": {
"name": "updateShippingTemplate",
"description": "Updates a ShippingTemplate",
"uri": "/shipping/templates/:shipping_template_id",
"params": {
"shipping_template_id": "int",
"title": "string",
"origin_country_id": "int"
},
"defaults": {
"title": null,
"origin_country_id": null
},
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "PUT"
},
"deleteShippingTemplate": {
"name": "deleteShippingTemplate",
"description": "Deletes the ShippingTemplate with the given id.",
"uri": "/shipping/templates/:shipping_template_id",
"params": {
"shipping_template_id": "int"
},
"defaults": null,
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "DELETE"
},
"findAllShippingTemplateEntries": {
"name": "findAllShippingTemplateEntries",
"description": "Retrieves a set of ShippingTemplateEntry objects associated to a ShippingTemplate.",
"uri": "/shipping/templates/:shipping_template_id/entries",
"params": {
"shipping_template_id": "int",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "GET"
},
"createShippingTemplateEntry": {
"name": "createShippingTemplateEntry",
"description": "Creates a new ShippingTemplateEntry",
"uri": "/shipping/templates/entries",
"params": {
"shipping_template_id": "int",
"destination_country_id": "int",
"primary_cost": "float",
"secondary_cost": "float",
"destination_region_id": "int"
},
"defaults": {
"destination_country_id": null,
"destination_region_id": null
},
"type": "ShippingTemplateEntry",
"visibility": "private",
"http_method": "POST"
},
"getShippingTemplateEntry": {
"name": "getShippingTemplateEntry",
"description": "Retrieves a ShippingTemplateEntry by id.",
"uri": "/shipping/templates/entries/:shipping_template_entry_id",
"params": {
"shipping_template_entry_id": "array(int)"
},
"defaults": null,
"type": "ShippingTemplateEntry",
"visibility": "private",
"http_method": "GET"
},
"updateShippingTemplateEntry": {
"name": "updateShippingTemplateEntry",
"description": "Updates a ShippingTemplateEntry",
"uri": "/shipping/templates/entries/:shipping_template_entry_id",
"params": {
"shipping_template_entry_id": "int",
"destination_country_id": "int",
"primary_cost": "float",
"secondary_cost": "float"
},
"defaults": {
"destination_country_id": null,
"primary_cost": null,
"secondary_cost": null
},
"type": "ShippingTemplateEntry",
"visibility": "private",
"http_method": "PUT"
},
"deleteShippingTemplateEntry": {
"name": "deleteShippingTemplateEntry",
"description": "Deletes the ShippingTemplateEntry",
"uri": "/shipping/templates/entries/:shipping_template_entry_id",
"params": {
"shipping_template_entry_id": "int"
},
"defaults": null,
"type": "ShippingTemplateEntry",
"visibility": "private",
"http_method": "DELETE"
},
"findAllShops": {
"name": "findAllShops",
"description": "Finds all Shops. If there is a keywords parameter, finds shops with shop_name starting with keywords.",
"uri": "/shops",
"params": {
"shop_name": "string (length >= 3)",
"limit": "int",
"offset": "int",
"page": "int",
"lat": "latitude",
"lon": "longitude",
"distance_max": "float"
},
"defaults": {
"shop_name": null,
"limit": 25,
"offset": 0,
"page": null,
"lat": null,
"lon": null,
"distance_max": 35
},
"type": "Shop",
"visibility": "public",
"http_method": "GET"
},
"getShop": {
"name": "getShop",
"description": "Retrieves a Shop by id.",
"uri": "/shops/:shop_id",
"params": {
"shop_id": "array(shop_id_or_name)"
},
"defaults": null,
"type": "Shop",
"visibility": "public",
"http_method": "GET"
},
"updateShop": {
"name": "updateShop",
"description": "Updates a Shop",
"uri": "/shops/:shop_id",
"params": {
"shop_id": "shop_id_or_name",
"title": "string",
"announcement": "text",
"sale_message": "text",
"policy_welcome": "text",
"policy_payment": "text",
"policy_shipping": "text",
"policy_refunds": "text",
"policy_additional": "text",
"policy_seller_info": "text"
},
"defaults": {
"title": null,
"announcement": null,
"sale_message": null,
"policy_welcome": null,
"policy_payment": null,
"policy_shipping": null,
"policy_refunds": null,
"policy_additional": null,
"policy_seller_info": null
},
"type": "Shop",
"visibility": "private",
"http_method": "PUT"
},
"getShopAbout": {
"name": "getShopAbout",
"description": "Retrieves a ShopAbout object associated to a Shop.",
"uri": "/shops/:shop_id/about",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "ShopAbout",
"visibility": "public",
"http_method": "GET"
},
"uploadShopBanner": {
"name": "uploadShopBanner",
"description": "Upload a new shop banner image",
"uri": "/shops/:shop_id/appearance/banner",
"params": {
"shop_id": "shop_id_or_name",
"image": "imagefile"
},
"defaults": null,
"type": "Shop",
"visibility": "private",
"http_method": "POST"
},
"deleteShopBanner": {
"name": "deleteShopBanner",
"description": "Deletes a shop banner image",
"uri": "/shops/:shop_id/appearance/banner",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "Shop",
"visibility": "private",
"http_method": "DELETE"
},
"findAllShopCoupons": {
"name": "findAllShopCoupons",
"description": "Retrieves all Shop_Coupons by shop_id",
"uri": "/shops/:shop_id/coupons",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "Coupon",
"visibility": "private",
"http_method": "GET"
},
"createCoupon": {
"name": "createCoupon",
"description": "Creates a new Coupon. May only have one of <code>free_shipping</code>, <code>pct_discount</code> or <code>fixed_discount</code>",
"uri": "/shops/:shop_id/coupons",
"params": {
"shop_id": "shop_id_or_name",
"coupon_code": "string",
"pct_discount": "int",
"seller_active": "boolean",
"free_shipping": "boolean",
"domestic_only": "boolean",
"currency_code": "string",
"fixed_discount": "string",
"minimum_purchase_price": "string",
"expiration_date": "int"
},
"defaults": {
"pct_discount": null,
"seller_active": "false",
"free_shipping": "false",
"domestic_only": "false",
"currency_code": "USD",
"fixed_discount": null,
"minimum_purchase_price": null,
"expiration_date": null
},
"type": "Coupon",
"visibility": "private",
"http_method": "POST"
},
"findCoupon": {
"name": "findCoupon",
"description": "Retrieves a Shop_Coupon by id and shop_id",
"uri": "/shops/:shop_id/coupons/:coupon_id",
"params": {
"shop_id": "shop_id_or_name",
"coupon_id": "int"
},
"defaults": null,
"type": "Coupon",
"visibility": "private",
"http_method": "GET"
},
"updateCoupon": {
"name": "updateCoupon",
"description": "Updates a coupon",
"uri": "/shops/:shop_id/coupons/:coupon_id",
"params": {
"shop_id": "shop_id_or_name",
"coupon_id": "int",
"seller_active": "boolean"
},
"defaults": {
"seller_active": "false"
},
"type": "Coupon",
"visibility": "private",
"http_method": "PUT"
},
"deleteCoupon": {
"name": "deleteCoupon",
"description": "Deletes a coupon",
"uri": "/shops/:shop_id/coupons/:coupon_id",
"params": {
"shop_id": "shop_id_or_name",
"coupon_id": "int"
},
"defaults": null,
"type": "Coupon",
"visibility": "private",
"http_method": "DELETE"
},
"findLedger": {
"name": "findLedger",
"description": "Get a Shop Payment Account Ledger",
"uri": "/shops/:shop_id/ledger/",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "Ledger",
"visibility": "private",
"http_method": "GET"
},
"findLedgerEntries": {
"name": "findLedgerEntries",
"description": "Get a Shop Payment Account Ledger's Entries",
"uri": "/shops/:shop_id/ledger/entries",
"params": {
"shop_id": "shop_id_or_name",
"min_created": "epoch",
"max_created": "epoch",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"min_created": null,
"max_created": null,
"limit": 25,
"offset": 0,
"page": null
},
"type": "LedgerEntry",
"visibility": "private",
"http_method": "GET"
},
"findAllShopListingsActive": {
"name": "findAllShopListingsActive",
"description": "Finds all active Listings associated with a Shop.<br /><br />(<strong>NOTE:</strong> If calling on behalf of a shop owner in the context of listing management, be sure to include the parameter <strong>include_private = true</strong>. This will return private listings that are not publicly visible in the shop, but which can be managed. This is an experimental feature and may change.)",
"uri": "/shops/:shop_id/listings/active",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"shop_id": "shop_id_or_name",
"keywords": "string",
"sort_on": "enum(created, price, score)",
"sort_order": "enum(up, down)",
"min_price": "float",
"max_price": "float",
"color": "color_triplet",
"color_accuracy": "color_wiggle",
"tags": "array(string)",
"category": "category",
"translate_keywords": "boolean",
"include_private": "boolean"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"keywords": null,
"sort_on": "created",
"sort_order": "down",
"min_price": null,
"max_price": null,
"color": null,
"color_accuracy": 0,
"tags": null,
"category": null,
"translate_keywords": "false",
"include_private": 0
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllShopListingsDraft": {
"name": "findAllShopListingsDraft",
"description": "Finds all of a Shop's draft listings",
"uri": "/shops/:shop_id/listings/draft",
"params": {
"shop_id": "shop_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"findAllShopListingsExpired": {
"name": "findAllShopListingsExpired",
"description": "Retrieves Listings associated to a Shop that are expired",
"uri": "/shops/:shop_id/listings/expired",
"params": {
"shop_id": "shop_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"getShopListingExpired": {
"name": "getShopListingExpired",
"description": "Retrieves a Listing associated to a Shop that is inactive",
"uri": "/shops/:shop_id/listings/expired/:listing_id",
"params": {
"shop_id": "shop_id_or_name",
"listing_id": "int"
},
"defaults": null,
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"findAllShopListingsFeatured": {
"name": "findAllShopListingsFeatured",
"description": "Retrieves Listings associated to a Shop that are featured",
"uri": "/shops/:shop_id/listings/featured",
"params": {
"shop_id": "shop_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllShopListingsInactive": {
"name": "findAllShopListingsInactive",
"description": "Retrieves Listings associated to a Shop that are inactive",
"uri": "/shops/:shop_id/listings/inactive",
"params": {
"shop_id": "shop_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"getShopListingInactive": {
"name": "getShopListingInactive",
"description": "Retrieves a Listing associated to a Shop that is inactive",
"uri": "/shops/:shop_id/listings/inactive/:listing_id",
"params": {
"shop_id": "shop_id_or_name",
"listing_id": "int"
},
"defaults": null,
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"findShopPaymentTemplates": {
"name": "findShopPaymentTemplates",
"description": "Retrieves the PaymentTemplate associated with the Shop",
"uri": "/shops/:shop_id/payment_templates",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "PaymentTemplate",
"visibility": "public",
"http_method": "GET"
},
"createShopPaymentTemplate": {
"name": "createShopPaymentTemplate",
"description": "Creates a new PaymentTemplate",
"uri": "/shops/:shop_id/payment_templates",
"params": {
"shop_id": "shop_id_or_name",
"allow_check": "boolean",
"allow_mo": "boolean",
"allow_other": "boolean",
"allow_paypal": "boolean",
"allow_cc": "boolean",
"paypal_email": "string",
"name": "string",
"first_line": "string",
"second_line": "string",
"city": "string",
"state": "string",
"zip": "string",
"country_id": "int"
},
"defaults": {
"allow_check": null,
"allow_mo": null,
"allow_other": null,
"allow_paypal": null,
"allow_cc": null,
"paypal_email": null,
"name": null,
"first_line": null,
"second_line": null,
"city": null,
"state": null,
"zip": null,
"country_id": null
},
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "POST"
},
"updateShopPaymentTemplate": {
"name": "updateShopPaymentTemplate",
"description": "Updates a PaymentTemplate",
"uri": "/shops/:shop_id/payment_templates/:payment_template_id",
"params": {
"shop_id": "shop_id_or_name",
"allow_check": "boolean",
"allow_mo": "boolean",
"allow_other": "boolean",
"allow_paypal": "boolean",
"allow_cc": "boolean",
"paypal_email": "string",
"name": "string",
"first_line": "string",
"second_line": "string",
"city": "string",
"state": "string",
"zip": "string",
"country_id": "int",
"payment_template_id": "int"
},
"defaults": {
"allow_check": null,
"allow_mo": null,
"allow_other": null,
"allow_paypal": null,
"allow_cc": null,
"paypal_email": null,
"name": null,
"first_line": null,
"second_line": null,
"city": null,
"state": null,
"zip": null,
"country_id": null
},
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "PUT"
},
"findAllShopReceipts": {
"name": "findAllShopReceipts",
"description": "Retrieves a set of Receipt objects associated to a Shop.",
"uri": "/shops/:shop_id/receipts",
"params": {
"shop_id": "shop_id_or_name",
"min_created": "epoch",
"max_created": "epoch",
"min_last_modified": "int",
"max_last_modified": "int",
"limit": "int",
"offset": "int",
"page": "int",
"was_paid": "boolean",
"was_shipped": "boolean"
},
"defaults": {
"min_created": null,
"max_created": null,
"min_last_modified": null,
"max_last_modified": null,
"limit": 25,
"offset": 0,
"page": null,
"was_paid": null,
"was_shipped": null
},
"type": "Receipt",
"visibility": "private",
"http_method": "GET"
},
"submitTracking": {
"name": "submitTracking",
"description": "Submits tracking information and sends a shipping notification email to the buyer. If <code>send_bcc</code> is <code>true</code>, the shipping notification will be sent to the seller as well. Refer to <a href=\"/developers/documentation/getting_started/seller_tools#section_tracking_codes\">additional documentation</a>.",
"uri": "/shops/:shop_id/receipts/:receipt_id/tracking",
"params": {
"tracking_code": "string",
"carrier_name": "string",
"send_bcc": "boolean"
},
"defaults": {
"send_bcc": false
},
"type": "Receipt",
"visibility": "private",
"http_method": "POST"
},
"findAllShopReceiptsByStatus": {
"name": "findAllShopReceiptsByStatus",
"description": "Retrieves a set of Receipt objects associated to a Shop based on the status.",
"uri": "/shops/:shop_id/receipts/:status",
"params": {
"shop_id": "shop_id_or_name",
"status": "enum(open, unshipped, unpaid, completed, processing, all)",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Receipt",
"visibility": "private",
"http_method": "GET"
},
"findAllShopSections": {
"name": "findAllShopSections",
"description": "Retrieves a set of ShopSection objects associated to a Shop.",
"uri": "/shops/:shop_id/sections",
"params": {
"shop_id": "shop_id_or_name"
},
"defaults": null,
"type": "ShopSection",
"visibility": "public",
"http_method": "GET"
},
"createShopSection": {
"name": "createShopSection",
"description": "Creates a new ShopSection.",
"uri": "/shops/:shop_id/sections",
"params": {
"shop_id": "shop_id_or_name",
"title": "text",
"user_id": "int"
},
"defaults": {
"title": null,
"user_id": null
},
"type": "ShopSection",
"visibility": "private",
"http_method": "POST"
},
"getShopSection": {
"name": "getShopSection",
"description": "Retrieves a ShopSection by id and shop_id",
"uri": "/shops/:shop_id/sections/:shop_section_id",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "array(int)"
},
"defaults": null,
"type": "ShopSection",
"visibility": "public",
"http_method": "GET"
},
"updateShopSection": {
"name": "updateShopSection",
"description": "Updates a ShopSection with the given id.",
"uri": "/shops/:shop_id/sections/:shop_section_id",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int",
"title": "text",
"user_id": "int",
"rank": "int"
},
"defaults": {
"title": null,
"user_id": null,
"rank": null
},
"type": "ShopSection",
"visibility": "private",
"http_method": "PUT"
},
"deleteShopSection": {
"name": "deleteShopSection",
"description": "Deletes the ShopSection with the given id.",
"uri": "/shops/:shop_id/sections/:shop_section_id",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int"
},
"defaults": null,
"type": "ShopSection",
"visibility": "private",
"http_method": "DELETE"
},
"findAllShopSectionListings": {
"name": "findAllShopSectionListings",
"description": "Finds all listings within a shop section",
"uri": "/shops/:shop_id/sections/:shop_section_id/listings",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"shop_id": "shop_id_or_name",
"shop_section_id": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"findAllShopSectionListingsActive": {
"name": "findAllShopSectionListingsActive",
"description": "Finds all listings within a shop section",
"uri": "/shops/:shop_id/sections/:shop_section_id/listings/active",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"shop_id": "shop_id_or_name",
"shop_section_id": "array(int)",
"sort_on": "enum(created, price)",
"sort_order": "enum(up, down)"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"sort_on": "created",
"sort_order": "down"
},
"type": "Listing",
"visibility": "public",
"http_method": "GET"
},
"getShopSectionTranslation": {
"name": "getShopSectionTranslation",
"description": "Retrieves a ShopSectionTranslation by shop_id, shop_section_id and language",
"uri": "/shops/:shop_id/sections/:shop_section_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int",
"language": "language"
},
"defaults": null,
"type": "ShopSectionTranslation",
"visibility": "public",
"http_method": "GET"
},
"createShopSectionTranslation": {
"name": "createShopSectionTranslation",
"description": "Creates a ShopSectionTranslation by shop_id, shop_section_id and language",
"uri": "/shops/:shop_id/sections/:shop_section_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int",
"language": "language"
},
"defaults": null,
"type": "ShopSectionTranslation",
"visibility": "private",
"http_method": "POST"
},
"updateShopSectionTranslation": {
"name": "updateShopSectionTranslation",
"description": "Updates a ShopSectionTranslation by shop_id, shop_section_id and language",
"uri": "/shops/:shop_id/sections/:shop_section_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int",
"language": "language"
},
"defaults": null,
"type": "ShopSectionTranslation",
"visibility": "private",
"http_method": "PUT"
},
"deleteShopSectionTranslation": {
"name": "deleteShopSectionTranslation",
"description": "Deletes a ShopSectionTranslation by shop_id, shop_section_id and language",
"uri": "/shops/:shop_id/sections/:shop_section_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"shop_section_id": "int",
"language": "language"
},
"defaults": null,
"type": "ShopSectionTranslation",
"visibility": "private",
"http_method": "DELETE"
},
"findAllShopTransactions": {
"name": "findAllShopTransactions",
"description": "Retrieves a set of Transaction objects associated to a Shop.",
"uri": "/shops/:shop_id/transactions",
"params": {
"shop_id": "shop_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Transaction",
"visibility": "private",
"http_method": "GET"
},
"getShopTranslation": {
"name": "getShopTranslation",
"description": "Retrieves a ShopTranslation by shop_id and language",
"uri": "/shops/:shop_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"language": "language"
},
"defaults": null,
"type": "ShopTranslation",
"visibility": "public",
"http_method": "GET"
},
"createShopTranslation": {
"name": "createShopTranslation",
"description": "Creates a ShopTranslation by shop_id and language",
"uri": "/shops/:shop_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"language": "language"
},
"defaults": null,
"type": "ShopTranslation",
"visibility": "private",
"http_method": "POST"
},
"updateShopTranslation": {
"name": "updateShopTranslation",
"description": "Updates a ShopTranslation by shop_id and language",
"uri": "/shops/:shop_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"language": "language"
},
"defaults": null,
"type": "ShopTranslation",
"visibility": "private",
"http_method": "PUT"
},
"deleteShopTranslation": {
"name": "deleteShopTranslation",
"description": "Deletes a ShopTranslation by shop_id and language",
"uri": "/shops/:shop_id/translations/:language",
"params": {
"shop_id": "shop_id_or_name",
"language": "language"
},
"defaults": null,
"type": "ShopTranslation",
"visibility": "private",
"http_method": "DELETE"
},
"findAllTopCategory": {
"name": "findAllTopCategory",
"description": "Retrieves all top-level Categories.",
"uri": "/taxonomy/categories",
"params": null,
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"findAllTopCategoryChildren": {
"name": "findAllTopCategoryChildren",
"description": "Retrieves children of a top-level Category by tag.",
"uri": "/taxonomy/categories/:tag",
"params": {
"tag": "string"
},
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"findAllSubCategoryChildren": {
"name": "findAllSubCategoryChildren",
"description": "Retrieves children of a second-level Category by tag and subtag.",
"uri": "/taxonomy/categories/:tag/:subtag",
"params": {
"tag": "string",
"subtag": "string"
},
"defaults": null,
"type": "Category",
"visibility": "public",
"http_method": "GET"
},
"findSuggestedStyles": {
"name": "findSuggestedStyles",
"description": "Retrieve all suggested styles.",
"uri": "/taxonomy/styles",
"params": null,
"defaults": null,
"type": "Style",
"visibility": "public",
"http_method": "GET"
},
"findAllTeams": {
"name": "findAllTeams",
"description": "Returns all Teams",
"uri": "/teams",
"params": {
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Team",
"visibility": "public",
"http_method": "GET"
},
"findAllUsersForTeam": {
"name": "findAllUsersForTeam",
"description": "Returns a list of users for a specific team",
"uri": "/teams/:team_id/users/",
"params": {
"team_id": "int",
"status": "enum(active, invited, pending)",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"status": "active",
"limit": 25,
"offset": 0,
"page": null
},
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"findTeams": {
"name": "findTeams",
"description": "Returns specified team by ID or team name",
"uri": "/teams/:team_ids/",
"params": {
"team_ids": "array(team_id_or_name)"
},
"defaults": null,
"type": "Team",
"visibility": "public",
"http_method": "GET"
},
"getTransaction": {
"name": "getTransaction",
"description": "Retrieves a Transaction by id.",
"uri": "/transactions/:transaction_id",
"params": {
"transaction_id": "array(int)"
},
"defaults": null,
"type": "Transaction",
"visibility": "private",
"http_method": "GET"
},
"findAllTreasuries": {
"name": "findAllTreasuries",
"description": "Search Treasuries or else List all Treasuries",
"uri": "/treasuries",
"params": {
"keywords": "treasury_search_string",
"sort_on": "enum(hotness, created)",
"sort_order": "enum(up, down)",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"keywords": null,
"sort_on": "hotness",
"sort_order": "down",
"limit": 25,
"offset": 0,
"page": null
},
"type": "Treasury",
"visibility": "public",
"http_method": "GET"
},
"createTreasury": {
"name": "createTreasury",
"description": "Create a Treasury",
"uri": "/treasuries",
"params": {
"title": "treasury_title",
"description": "treasury_description",
"listing_ids": "array(int)",
"tags": "array(string)",
"private": "boolean"
},
"defaults": {
"description": null,
"tags": "",
"private": 0
},
"type": "Treasury",
"visibility": "private",
"http_method": "POST"
},
"getTreasury": {
"name": "getTreasury",
"description": "Get a Treasury",
"uri": "/treasuries/:treasury_key",
"params": {
"treasury_key": "treasury_id"
},
"defaults": null,
"type": "Treasury",
"visibility": "public",
"http_method": "GET"
},
"deleteTreasury": {
"name": "deleteTreasury",
"description": "Delete a Treasury",
"uri": "/treasuries/:treasury_key",
"params": null,
"defaults": null,
"type": "Treasury",
"visibility": "private",
"http_method": "DELETE"
},
"findTreasuryComments": {
"name": "findTreasuryComments",
"description": "Get a Treasury's Comments",
"uri": "/treasuries/:treasury_key/comments",
"params": {
"treasury_key": "treasury_id",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "ForumPost",
"visibility": "public",
"http_method": "GET"
},
"postTreasuryComment": {
"name": "postTreasuryComment",
"description": "Leave a comment on a Treasury List",
"uri": "/treasuries/:treasury_key/comments",
"params": {
"message": "forum_post"
},
"defaults": null,
"type": "ForumPost",
"visibility": "private",
"http_method": "POST"
},
"deleteTreasuryComment": {
"name": "deleteTreasuryComment",
"description": "Delete a given comment on a Treasury List",
"uri": "/treasuries/:treasury_key/comments/:comment_id",
"params": null,
"defaults": null,
"type": "ForumPost",
"visibility": "private",
"http_method": "DELETE"
},
"addTreasuryListing": {
"name": "addTreasuryListing",
"description": "Add listing to a Treasury",
"uri": "/treasuries/:treasury_key/listings",
"params": {
"treasury_key": "treasury_id",
"listing_id": "int"
},
"defaults": null,
"type": "TreasuryListing",
"visibility": "private",
"http_method": "POST"
},
"removeTreasuryListing": {
"name": "removeTreasuryListing",
"description": "Remove listing from a Treasury",
"uri": "/treasuries/:treasury_key/listings/:listing_id",
"params": {
"treasury_key": "treasury_id",
"listing_id": "int"
},
"defaults": null,
"type": "TreasuryListing",
"visibility": "private",
"http_method": "DELETE"
},
"describeOccasionEnum": {
"name": "describeOccasionEnum",
"description": "Describes the legal values for Listing.occasion.",
"uri": "/types/enum/occasion",
"params": null,
"defaults": null,
"type": "DataType",
"visibility": "public",
"http_method": "GET"
},
"describeRecipientEnum": {
"name": "describeRecipientEnum",
"description": "Describes the legal values for Listing.recipient.",
"uri": "/types/enum/recipient",
"params": null,
"defaults": null,
"type": "DataType",
"visibility": "public",
"http_method": "GET"
},
"describeWhenMadeEnum": {
"name": "describeWhenMadeEnum",
"description": "Describes the legal values for Listing.when_made.",
"uri": "/types/enum/when_made",
"params": {
"include_formatted": "boolean"
},
"defaults": {
"include_formatted": null
},
"type": "DataType",
"visibility": "public",
"http_method": "GET"
},
"describeWhoMadeEnum": {
"name": "describeWhoMadeEnum",
"description": "Describes the legal values for Listing.who_made.",
"uri": "/types/enum/who_made",
"params": null,
"defaults": null,
"type": "DataType",
"visibility": "public",
"http_method": "GET"
},
"findAllUsers": {
"name": "findAllUsers",
"description": "Finds all Users whose name or username match the keywords parameter.",
"uri": "/users",
"params": {
"keywords": "string",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"keywords": null,
"limit": 25,
"offset": 0,
"page": null
},
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"getUser": {
"name": "getUser",
"description": "Retrieves a User by id.",
"uri": "/users/:user_id",
"params": {
"user_id": "array(user_id_or_name)"
},
"defaults": null,
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"findAllUserAddresses": {
"name": "findAllUserAddresses",
"description": "Retrieves a set of UserAddress objects associated to a User.",
"uri": "/users/:user_id/addresses",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "UserAddress",
"visibility": "private",
"http_method": "GET"
},
"createUserAddress": {
"name": "createUserAddress",
"description": "Creates a new UserAddress.",
"uri": "/users/:user_id/addresses/",
"params": {
"user_id": "user_id_or_name",
"name": "string",
"first_line": "string",
"second_line": "string",
"city": "string",
"state": "string",
"zip": "string",
"country_id": "int"
},
"defaults": {
"second_line": null,
"state": null
},
"type": "UserAddress",
"visibility": "private",
"http_method": "POST"
},
"getUserAddress": {
"name": "getUserAddress",
"description": "Retrieves a UserAddress by id.",
"uri": "/users/:user_id/addresses/:user_address_id",
"params": {
"user_address_id": "array(int)"
},
"defaults": null,
"type": "UserAddress",
"visibility": "private",
"http_method": "GET"
},
"deleteUserAddress": {
"name": "deleteUserAddress",
"description": "Deletes the UserAddress with the given id.",
"uri": "/users/:user_id/addresses/:user_address_id",
"params": {
"user_address_id": "int"
},
"defaults": null,
"type": "UserAddress",
"visibility": "private",
"http_method": "DELETE"
},
"uploadAvatar": {
"name": "uploadAvatar",
"description": "Upload a new user avatar image",
"uri": "/users/:user_id/avatar",
"params": {
"src": "string",
"user_id": "user_id_or_name",
"image": "image"
},
"defaults": {
"src": null,
"image": null
},
"type": "Avatar",
"visibility": "private",
"http_method": "POST"
},
"getAvatarImgSrc": {
"name": "getAvatarImgSrc",
"description": "Get avatar image source",
"uri": "/users/:user_id/avatar/src",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "Avatar",
"visibility": "public",
"http_method": "GET"
},
"getUserBillingOverview": {
"name": "getUserBillingOverview",
"description": "Retrieves the user's current balance.",
"uri": "/users/:user_id/billing/overview",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "BillingOverview",
"visibility": "private",
"http_method": "GET"
},
"getAllUserCarts": {
"name": "getAllUserCarts",
"description": "Get a user's Carts",
"uri": "/users/:user_id/carts",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "Cart",
"visibility": "private",
"http_method": "GET"
},
"addToCart": {
"name": "addToCart",
"description": "Add a listing to a cart",
"uri": "/users/:user_id/carts",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int",
"quantity": "int",
"selected_variations": "map(int, int)"
},
"defaults": {
"quantity": 1,
"selected_variations": null
},
"type": "Cart",
"visibility": "private",
"http_method": "POST"
},
"updateCartListingQuantity": {
"name": "updateCartListingQuantity",
"description": "Update a cart listing purchase quantity",
"uri": "/users/:user_id/carts",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int",
"quantity": "int",
"listing_customization_id": "int"
},
"defaults": {
"listing_customization_id": 0
},
"type": "Cart",
"visibility": "private",
"http_method": "PUT"
},
"removeCartListing": {
"name": "removeCartListing",
"description": "Remove a listing from a cart",
"uri": "/users/:user_id/carts",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int",
"listing_customization_id": "int"
},
"defaults": {
"listing_customization_id": 0
},
"type": "Cart",
"visibility": "private",
"http_method": "DELETE"
},
"getUserCart": {
"name": "getUserCart",
"description": "Get a cart",
"uri": "/users/:user_id/carts/:cart_id",
"params": {
"user_id": "user_id_or_name",
"cart_id": "cart_id"
},
"defaults": null,
"type": "Cart",
"visibility": "private",
"http_method": "GET"
},
"updateCart": {
"name": "updateCart",
"description": "Update a cart",
"uri": "/users/:user_id/carts/:cart_id",
"params": {
"user_id": "user_id_or_name",
"cart_id": "cart_id",
"destination_country_id": "int",
"message_to_seller": "text",
"coupon_code": "string"
},
"defaults": {
"destination_country_id": null,
"message_to_seller": null,
"coupon_code": null
},
"type": "Cart",
"visibility": "private",
"http_method": "PUT"
},
"deleteCart": {
"name": "deleteCart",
"description": "Delete a cart",
"uri": "/users/:user_id/carts/:cart_id",
"params": {
"user_id": "user_id_or_name",
"cart_id": "cart_id"
},
"defaults": null,
"type": "Cart",
"visibility": "private",
"http_method": "DELETE"
},
"findAllCartListings": {
"name": "findAllCartListings",
"description": "Finds all listings in a given Cart",
"uri": "/users/:user_id/carts/:cart_id/listings",
"params": {
"user_id": "user_id_or_name",
"cart_id": "cart_id"
},
"defaults": null,
"type": "Listing",
"visibility": "private",
"http_method": "GET"
},
"findAllUserCharges": {
"name": "findAllUserCharges",
"description": "Retrieves a set of BillCharge objects associated to a User. NOTE: from 8/8/12 the min_created and max_created arguments will be mandatory and can be no more than 31 days apart.",
"uri": "/users/:user_id/charges",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"user_id": "user_id_or_name",
"sort_order": "enum(up, down)",
"min_created": "epoch",
"max_created": "epoch"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"sort_order": "up",
"min_created": null,
"max_created": null
},
"type": "BillCharge",
"visibility": "private",
"http_method": "GET"
},
"getUserChargesMetadata": {
"name": "getUserChargesMetadata",
"description": "Metadata for the set of BillCharges objects associated to a User",
"uri": "/users/:user_id/charges/meta",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "Dict",
"visibility": "private",
"http_method": "GET"
},
"getCirclesContainingUser": {
"name": "getCirclesContainingUser",
"description": "Returns a list of users who have circled this user",
"uri": "/users/:user_id/circles",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"getConnectedUser": {
"name": "getConnectedUser",
"description": "Returns details about a connection between users",
"uri": "/users/:user_id/circles/:to_user_id",
"params": {
"user_id": "user_id_or_name",
"to_user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"unconnectUsers": {
"name": "unconnectUsers",
"description": "Removes a user (to_user_id) from the logged in user's (user_id) circle",
"uri": "/users/:user_id/circles/:to_user_id",
"params": {
"user_id": "user_id_or_name",
"to_user_id": "user_id_or_name"
},
"defaults": null,
"type": "User",
"visibility": "private",
"http_method": "DELETE"
},
"getConnectedUsers": {
"name": "getConnectedUsers",
"description": "Returns a list of users that are in this user's cricle",
"uri": "/users/:user_id/connected_users",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "User",
"visibility": "public",
"http_method": "GET"
},
"connectUsers": {
"name": "connectUsers",
"description": "Adds user (to_user_id) to the user's (user_id) circle",
"uri": "/users/:user_id/connected_users",
"params": {
"user_id": "user_id_or_name",
"to_user_id": "user_id_or_name"
},
"defaults": null,
"type": "User",
"visibility": "private",
"http_method": "POST"
},
"findAllUserFavoredBy": {
"name": "findAllUserFavoredBy",
"description": "Retrieves a set of FavoriteUser objects associated to a User.",
"uri": "/users/:user_id/favored-by",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "FavoriteUser",
"visibility": "public",
"http_method": "GET"
},
"findAllUserFavoriteListings": {
"name": "findAllUserFavoriteListings",
"description": "Finds all favorite listings for a user",
"uri": "/users/:user_id/favorites/listings",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "FavoriteListing",
"visibility": "public",
"http_method": "GET"
},
"findUserFavoriteListings": {
"name": "findUserFavoriteListings",
"description": "Finds a favorite listing for a user",
"uri": "/users/:user_id/favorites/listings/:listing_id",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int"
},
"defaults": null,
"type": "FavoriteListing",
"visibility": "public",
"http_method": "GET"
},
"createUserFavoriteListings": {
"name": "createUserFavoriteListings",
"description": "Creates a new favorite listing for a user",
"uri": "/users/:user_id/favorites/listings/:listing_id",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int"
},
"defaults": null,
"type": "FavoriteListing",
"visibility": "private",
"http_method": "POST"
},
"deleteUserFavoriteListings": {
"name": "deleteUserFavoriteListings",
"description": "Delete a favorite listing for a user",
"uri": "/users/:user_id/favorites/listings/:listing_id",
"params": {
"user_id": "user_id_or_name",
"listing_id": "int"
},
"defaults": null,
"type": "FavoriteListing",
"visibility": "private",
"http_method": "DELETE"
},
"findAllUserFavoriteUsers": {
"name": "findAllUserFavoriteUsers",
"description": "Finds all favorite users for a user",
"uri": "/users/:user_id/favorites/users",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "FavoriteUser",
"visibility": "public",
"http_method": "GET"
},
"findUserFavoriteUsers": {
"name": "findUserFavoriteUsers",
"description": "Finds a favorite user for a user",
"uri": "/users/:user_id/favorites/users/:target_user_id",
"params": {
"user_id": "user_id_or_name",
"target_user_id": "user_id_or_name"
},
"defaults": null,
"type": "FavoriteUser",
"visibility": "public",
"http_method": "GET"
},
"createUserFavoriteUsers": {
"name": "createUserFavoriteUsers",
"description": "Creates a new favorite listing for a user",
"uri": "/users/:user_id/favorites/users/:target_user_id",
"params": {
"user_id": "user_id_or_name",
"target_user_id": "user_id_or_name"
},
"defaults": null,
"type": "FavoriteUser",
"visibility": "private",
"http_method": "POST"
},
"deleteUserFavoriteUsers": {
"name": "deleteUserFavoriteUsers",
"description": "Delete a favorite listing for a user",
"uri": "/users/:user_id/favorites/users/:target_user_id",
"params": {
"user_id": "user_id_or_name",
"target_user_id": "user_id_or_name"
},
"defaults": null,
"type": "FavoriteUser",
"visibility": "private",
"http_method": "DELETE"
},
"findAllUserFeedbackAsAuthor": {
"name": "findAllUserFeedbackAsAuthor",
"description": "Retrieves a set of Feedback objects associated to a User.",
"uri": "/users/:user_id/feedback/as-author",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllUserFeedbackAsBuyer": {
"name": "findAllUserFeedbackAsBuyer",
"description": "Retrieves a set of Feedback objects associated to a User.",
"uri": "/users/:user_id/feedback/as-buyer",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllUserFeedbackAsSeller": {
"name": "findAllUserFeedbackAsSeller",
"description": "Retrieves a set of Feedback objects associated to a User.",
"uri": "/users/:user_id/feedback/as-seller",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllUserFeedbackAsSubject": {
"name": "findAllUserFeedbackAsSubject",
"description": "Retrieves a set of Feedback objects associated to a User.",
"uri": "/users/:user_id/feedback/as-subject",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllFeedbackFromBuyers": {
"name": "findAllFeedbackFromBuyers",
"description": "\n Returns a set of FeedBack objects associated to a User.\n This is essentially the union between the findAllUserFeedbackAsBuyer\n and findAllUserFeedbackAsSubject methods.",
"uri": "/users/:user_id/feedback/from-buyers",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"user_id": null,
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllFeedbackFromSellers": {
"name": "findAllFeedbackFromSellers",
"description": "\n Returns a set of FeedBack objects associated to a User.\n This is essentially the union between\n the findAllUserFeedbackAsBuyer and findAllUserFeedbackAsSubject methods.",
"uri": "/users/:user_id/feedback/from-sellers",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"user_id": null,
"limit": 25,
"offset": 0,
"page": null
},
"type": "Feedback",
"visibility": "public",
"http_method": "GET"
},
"findAllUserOrders": {
"name": "findAllUserOrders",
"description": "Retrieves a set of Order objects associated to a User.",
"uri": "/users/:user_id/orders",
"params": {
"user_id": "user_id_or_name",
"min_created": "epoch",
"max_created": "epoch",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"min_created": null,
"max_created": null,
"limit": 25,
"offset": 0,
"page": null
},
"type": "Order",
"visibility": "private",
"http_method": "GET"
},
"findAllUserPayments": {
"name": "findAllUserPayments",
"description": "Retrieves a set of BillPayment objects associated to a User.",
"uri": "/users/:user_id/payments",
"params": {
"limit": "int",
"offset": "int",
"page": "int",
"user_id": "user_id_or_name",
"sort_order": "enum(up, down)",
"min_created": "epoch",
"max_created": "epoch"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null,
"sort_order": "up",
"min_created": null,
"max_created": null
},
"type": "BillPayment",
"visibility": "private",
"http_method": "GET"
},
"findAllUserPaymentTemplates": {
"name": "findAllUserPaymentTemplates",
"description": "Retrieves a set of PaymentTemplate objects associated to a User.",
"uri": "/users/:user_id/payments/templates",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "PaymentTemplate",
"visibility": "private",
"http_method": "GET"
},
"findUserProfile": {
"name": "findUserProfile",
"description": "Returns the UserProfile object associated with a User.",
"uri": "/users/:user_id/profile",
"params": {
"user_id": "user_id_or_name"
},
"defaults": null,
"type": "UserProfile",
"visibility": "public",
"http_method": "GET"
},
"updateUserProfile": {
"name": "updateUserProfile",
"description": "Updates the UserProfile object associated with a User. <br /><b>Notes:</b><ul><li>Name changes are subject to admin review and therefore unavailable via the API.</li><li>Materials must be provided as a <i>period-separated</i> list of ASCII words.</ul>",
"uri": "/users/:user_id/profile",
"params": {
"user_id": "user_id_or_name",
"bio": "text",
"gender": "string",
"birth_month": "int",
"birth_day": "int",
"birth_year": "int",
"materials": "string",
"country_id": "string",
"region": "string",
"city": "string"
},
"defaults": {
"bio": null,
"gender": null,
"birth_month": null,
"birth_day": null,
"birth_year": null,
"materials": null,
"country_id": null,
"region": null,
"city": null
},
"type": "UserProfile",
"visibility": "private",
"http_method": "PUT"
},
"findAllUserBuyerReceipts": {
"name": "findAllUserBuyerReceipts",
"description": "Retrieves a set of Receipt objects associated to a User.",
"uri": "/users/:user_id/receipts",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Receipt",
"visibility": "private",
"http_method": "GET"
},
"findAllUserShippingProfiles": {
"name": "findAllUserShippingProfiles",
"description": "Retrieves a set of ShippingTemplate objects associated to a User.",
"uri": "/users/:user_id/shipping/templates",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "ShippingTemplate",
"visibility": "private",
"http_method": "GET"
},
"findAllUserShops": {
"name": "findAllUserShops",
"description": "Retrieves a set of Shop objects associated to a User.",
"uri": "/users/:user_id/shops",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Shop",
"visibility": "public",
"http_method": "GET"
},
"findAllTeamsForUser": {
"name": "findAllTeamsForUser",
"description": "Returns a list of teams for a specific user",
"uri": "/users/:user_id/teams",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Team",
"visibility": "public",
"http_method": "GET"
},
"findAllUserBuyerTransactions": {
"name": "findAllUserBuyerTransactions",
"description": "Retrieves a set of Transaction objects associated to a User.",
"uri": "/users/:user_id/transactions",
"params": {
"user_id": "user_id_or_name",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"limit": 25,
"offset": 0,
"page": null
},
"type": "Transaction",
"visibility": "private",
"http_method": "GET"
},
"findAllUserTreasuries": {
"name": "findAllUserTreasuries",
"description": "Get a user's Treasuries. <strong>Note:</strong> The <code>treasury_r</code> permission scope is required in order to display private Treasuries for a user when the boolean parameter <code>include_private</code> is <code>true</code>.",
"uri": "/users/:user_id/treasuries",
"params": {
"user_id": "user_id_or_name",
"sort_on": "enum(hotness, created)",
"sort_order": "enum(up, down)",
"include_private": "boolean",
"limit": "int",
"offset": "int",
"page": "int"
},
"defaults": {
"sort_on": "hotness",
"sort_order": "down",
"include_private": 0,
"limit": 25,
"offset": 0,
"page": null
},
"type": "Treasury",
"visibility": "public",
"http_method": "GET"
}
}
\ No newline at end of file
import oauth2 as oauth
import urllib
from cgi import parse_qsl
from etsy_env import EtsyEnvSandbox, EtsyEnvProduction
from etsy_env import EtsyEnvProduction
EtsyOAuthToken = oauth.Token
class EtsyOAuthClient(oauth.Client):
def __init__(self, oauth_consumer_key, oauth_consumer_secret, etsy_env=EtsyEnvSandbox(), token=None, logger=None):
def __init__(self, oauth_consumer_key,
oauth_consumer_secret, etsy_env=EtsyEnvProduction(),
token=None, logger=None):
consumer = oauth.Consumer(oauth_consumer_key, oauth_consumer_secret)
super(EtsyOAuthClient, self).__init__(consumer)
self.request_token_url = etsy_env.request_token_url
......@@ -16,17 +20,19 @@ class EtsyOAuthClient(oauth.Client):
self.logger = logger
def get_request_token(self, **kwargs):
request_token_url = '%s?%s' % (self.request_token_url, urllib.urlencode(kwargs))
request_token_url = '%s?%s' % (
self.request_token_url, urllib.urlencode(kwargs))
resp, content = self.request(request_token_url, 'GET')
return self._get_token(content)
def get_signin_url(self, **kwargs):
self.token = self.get_request_token(**kwargs)
if self.token is None: return None
if self.token is None:
return None
return self.signin_url + '?' + \
urllib.urlencode({'oauth_token': self.token.key})
urllib.urlencode({'oauth_token': self.token.key})
def get_access_token(self, oauth_verifier):
self.token.set_verifier(oauth_verifier)
......@@ -37,8 +43,10 @@ class EtsyOAuthClient(oauth.Client):
self.token = self.get_access_token(oauth_verifier)
def do_oauth_request(self, url, http_method, content_type, body):
if content_type and content_type != 'application/x-www-form-urlencoded':
resp, content = self.request(url, http_method, body=body, headers={'Content-Type': content_type})
if (content_type and content_type !=
'application/x-www-form-urlencoded'):
resp, content = self.request(url, http_method, body=body, headers={
'Content-Type': content_type})
else:
resp, content = self.request(url, http_method, body=body)
......@@ -52,5 +60,5 @@ class EtsyOAuthClient(oauth.Client):
try:
return oauth.Token(d['oauth_token'], d['oauth_token_secret'])
except KeyError, e:
except KeyError:
return None
#!/usr/bin/env python
import os, sys
import os
import sys
import oauth2 as oauth
import webbrowser
from etsy import Etsy, EtsyEnvSandbox, EtsyEnvProduction
from etsy import Etsy, EtsyEnvProduction
from etsy.oauth import EtsyOAuthClient
logging_enabled = True
etsy_env = EtsyEnvProduction()
def my_log(msg):
if logging_enabled: print(msg)
if logging_enabled:
print(msg)
def write_config_file(oauth_token):
os.umask(0077)
os.umask(0077) # noqa
config_file = file('config.py', 'w')
if config:
config_file.write("oauth_consumer_key = %r\n" % config.oauth_consumer_key)
config_file.write("oauth_consumer_secret = %r\n" % config.oauth_consumer_secret)
config_file.write("oauth_consumer_key = %r\n" %
config.oauth_consumer_key)
config_file.write("oauth_consumer_secret = %r\n" %
config.oauth_consumer_secret)
if oauth_token:
config_file.write("oauth_token_key = %r\n" % oauth_token.key)
......@@ -30,16 +36,20 @@ except ImportError:
config = None
write_config_file(oauth_token=None)
if hasattr(config, 'oauth_consumer_key') and hasattr(config, 'oauth_consumer_secret'):
if (hasattr(config, 'oauth_consumer_key') and
hasattr(config, 'oauth_consumer_secret')):
oauth_client = EtsyOAuthClient(
oauth_consumer_key=config.oauth_consumer_key,
oauth_consumer_secret=config.oauth_consumer_secret,
etsy_env=etsy_env)
else:
sys.stderr.write('ERROR: You must set oauth_consumer_key and oauth_consumer_secret in config.py\n')
sys.stderr.write(
'ERROR: You must set oauth_consumer_key and '
'oauth_consumer_secret in config.py\n')
sys.exit(1)
if hasattr(config, 'oauth_token_key') and hasattr(config, 'oauth_token_secret'):
if (hasattr(config, 'oauth_token_key') and
hasattr(config, 'oauth_token_secret')):
oauth_client.token = oauth.Token(
key=config.oauth_token_key,
secret=config.oauth_token_secret)
......@@ -50,17 +60,21 @@ else:
etsy_api = Etsy(etsy_oauth_client=oauth_client, etsy_env=etsy_env, log=my_log)
# print 'oauth access token: (key=%r; secret=%r)' % (oauth_client.token.key, oauth_client.token.secret)
# print 'oauth access token: (key=%r; secret=%r)' %
# (oauth_client.token.key, oauth_client.token.secret)
print('findAllShopListingsActive => %r' % etsy_api.findAllShopListingsActive(shop_id=config.user_id, sort_on='created', limit=1))
print('findAllShopListingsActive => %r' % etsy_api.findAllShopListingsActive(
shop_id=config.user_id, sort_on='created', limit=1))
# print('getListing => %r' % etsy_api.getListing(listing_id=63067548))
print('findAllUserShippingTemplates => %r' % etsy_api.findAllUserShippingTemplates(user_id=config.user_id))
print('findAllUserShippingTemplates => %r' %
etsy_api.findAllUserShippingTemplates(user_id=config.user_id))
def testCreateListing():
print "Creating listing..."
result = etsy_api.createListing(
description=config.description,
title=config.title,
......@@ -75,9 +89,9 @@ def testCreateListing():
print "Created listing with listing id %d" % listing_id
result = etsy_api.uploadListingImage(listing_id=listing_id, image=config.image_file)
result = etsy_api.uploadListingImage(listing_id=listing_id,
image=config.image_file)
print "Result of uploading image: %r" % result
testCreateListing()
pip==8.1.2
httplib2==0.9.2
oauth2==1.9.0.post1
simplejson==3.8.2
flake8==2.6.0
pytest==2.9.2
\ No newline at end of file
......@@ -5,19 +5,26 @@ from setuptools import setup
this_dir = os.path.realpath(os.path.dirname(__file__))
long_description = open(os.path.join(this_dir, 'README.md'), 'r').read()
requirements = [
]
test_requirements = [
'pytest',
]
setup(
name = 'etsy',
version = '0.3.1',
author = 'Dan McKinley',
author_email = 'dan@etsy.com',
description = 'Python access to the Etsy API',
license = 'GPL v3',
keywords = 'etsy api handmade',
packages = ['etsy'],
long_description = long_description,
test_suite = 'test',
name='etsy',
version='0.3.1',
author='Dan McKinley & Fulfil.IO Inc.',
author_email='dan@etsy.com',
description='Python access to the Etsy API',
license='GPL v3',
keywords='etsy api handmade',
packages=['etsy'],
long_description=long_description,
test_suite='test',
install_requires=['simplejson >= 2.0'],
extras_require = {
extras_require={
'OAuth': ["oauth2>=1.2.0"],
}
)
......@@ -5,23 +5,23 @@ from urlparse import urlparse
import os
from util import Test
import tempfile
from etsy.oauth import EtsyOAuthClient
class MockAPI(API):
api_key = 'abcdef'
api_url = 'http://host'
api_version = 'v1'
etsy_oauth_client = EtsyOAuthClient('consumer_key', 'consumer_secret')
def etsy_home(self):
return Test.scratch_dir
def get_method_table(self, *args):
return [{'name': 'testMethod',
'uri': '/test/{test_id}',
'http_method': 'GET',
'params': {
return [{'name': 'testMethod',
'uri': '/test/{test_id}',
'http_method': 'GET',
'params': {
'limit': 'int',
'test_id': 'user_id_or_name',
'offset': 'int',
......@@ -29,8 +29,8 @@ class MockAPI(API):
'buzz': 'float',
'blah': 'unknown type',
'kind': 'string',
},
'type': 'int',
},
'type': 'int',
'description': 'test method.'},
{'name': 'noPositionals',
'uri': '/blah',
......@@ -39,13 +39,12 @@ class MockAPI(API):
'type': 'int',
'description': 'no pos arguments'}]
def _get_url(self, url, http_method, content_type, body):
return '{ "count": 1, "results": [3] }'
class MockLog(object):
def __init__(self, test):
self.lines = []
self.test = test
......@@ -53,63 +52,40 @@ class MockLog(object):
def __call__(self, msg):
self.lines.append(msg)
def assertLine(self, msg):
failmsg = 'Could not find "%s" in the log. The log was:\n\n%s' % (
msg, '\n'.join([' %s' % x for x in self.lines]))
self.test.assertTrue(msg in self.lines, failmsg)
class CoreTests(Test):
def setUp(self):
self.api = MockAPI('apikey', log=MockLog(self))
def last_query(self):
qs = urlparse(self.api.last_url).query
return parse_qs(qs)
def test_method_created(self):
self.assertTrue('testMethod' in dir(self.api))
def test_url_params(self):
self.api.testMethod(test_id='foo')
self.assertEqual(self.api.last_url,
'http://host/test/foo?api_key=apikey')
def test_count_saved(self):
self.api.testMethod(test_id='foo')
self.assertTrue(self.api.count)
def test_results_returned(self):
x = self.api.testMethod(test_id='foo')
self.assertEquals(x, [3])
def test_query_params(self):
self.api.testMethod(test_id='foo', limit=1)
self.assertEqual(self.last_query(), {
'api_key': ['apikey'],
'limit': ['1'],
})
def test_docstring_set(self):
self.assertEquals(self.api.testMethod.__doc__,
'test method.')
def test_api_url_required(self):
msg = self.assertRaises(AssertionError, API, '')
self.assertEqual('No api_url configured.', msg)
def test_api_url_cannot_end_with_slash(self):
class Foo(API):
api_url = 'http://host/'
......@@ -117,7 +93,6 @@ class CoreTests(Test):
msg = self.assertRaises(AssertionError, Foo, '')
self.assertEqual('api_url should not end with a slash.', msg)
def test_api_should_define_version(self):
class Foo(API):
api_url = 'http://host'
......@@ -125,13 +100,6 @@ class CoreTests(Test):
msg = self.assertRaises(AssertionError, Foo)
self.assertEqual(msg, 'API object should define api_version')
def test_key_file_does_not_exist(self):
msg = self.assertRaises(AssertionError, MockAPI,
key_file='this does not exist')
self.assertTrue("'this does not exist' does not exist" in msg)
def test_reading_api_key(self):
with open('testkeys', 'w') as f:
f.write("v1 = 'abcdef'")
......@@ -140,155 +108,117 @@ class CoreTests(Test):
finally:
os.unlink('testkeys')
def test_unrecognized_kwarg(self):
msg = self.assertRaises(ValueError, self.api.testMethod,
msg = self.assertRaises(ValueError, self.api.testMethod,
test_id=1, not_an_arg=1)
self.assertEqual(msg, 'Unexpected argument: not_an_arg=1')
def test_unknown_parameter_type_is_passed(self):
self.api.testMethod(test_id=1, blah=1)
self.assertEqual(self.last_query()['blah'], ['1'])
def test_parameter_type_int(self):
self.api.testMethod(test_id=1, limit=5)
self.assertEqual(self.last_query()['limit'], ['5'])
def test_parameter_type_long(self):
self.api.testMethod(test_id=1L, limit=5L)
self.assertEqual(self.last_query()['limit'], ['5'])
def bad_value_msg(self, name, t, v):
return "Bad value for parameter %s of type '%s' - %s" % (name, t, v)
def test_invalid_parameter_type_int(self):
msg = self.assertRaises(ValueError, self.api.testMethod,
msg = self.assertRaises(ValueError, self.api.testMethod,
test_id=1, limit=5.6)
self.assertEqual(msg, self.bad_value_msg('limit', 'int', 5.6))
def test_parameter_type_float(self):
self.api.testMethod(test_id=1, buzz=42.1)
self.assertEqual(self.last_query()['buzz'], ['42.1'])
def test_invalid_parameter_type_float(self):
msg = self.assertRaises(ValueError, self.api.testMethod,
msg = self.assertRaises(ValueError, self.api.testMethod,
test_id=1, buzz='x')
self.assertEqual(msg, self.bad_value_msg('buzz', 'float', 'x'))
def test_int_accepted_as_float(self):
self.api.testMethod(test_id=1, buzz=3)
self.assertEqual(self.last_query()['buzz'], ['3'])
def test_parameter_type_enum(self):
self.api.testMethod(test_id=1, fizz='bar')
self.assertEqual(self.last_query()['fizz'], ['bar'])
def test_invalid_parameter_type_enum(self):
msg = self.assertRaises(ValueError, self.api.testMethod,
msg = self.assertRaises(ValueError, self.api.testMethod,
test_id=1, fizz='goo')
self.assertEqual(msg, self.bad_value_msg(
'fizz', 'enum(foo, bar, baz)', 'goo'))
'fizz', 'enum(foo, bar, baz)', 'goo'))
def test_parameter_type_string(self):
self.api.testMethod(test_id=1, kind='blah')
self.assertEqual(self.last_query()['kind'], ['blah'])
def test_invalid_parameter_type_string(self):
msg = self.assertRaises(ValueError, self.api.testMethod,
msg = self.assertRaises(ValueError, self.api.testMethod,
test_id=1, kind=Test)
self.assertEqual(msg, self.bad_value_msg('kind', 'string', Test))
def test_url_arguments_work_positionally(self):
self.api.testMethod('foo')
self.assertEqual(self.api.last_url,
'http://host/test/foo?api_key=apikey')
def test_method_with_no_positionals_doesnt_accept_them(self):
msg = self.assertRaises(ValueError, self.api.noPositionals, 1, 2)
self.assertEqual('Positional argument(s): (1, 2) provided, but this '
'method does not support them.', msg)
def test_too_many_positionals(self):
msg = self.assertRaises(ValueError, self.api.testMethod, 1, 2)
self.assertEqual('Too many positional arguments.', msg)
def test_positional_argument_not_provided(self):
msg = self.assertRaises(ValueError, self.api.testMethod)
self.assertEqual("Required argument 'test_id' not provided.", msg)
def test_positional_argument_duplicated_in_kwargs(self):
msg = self.assertRaises(ValueError, self.api.testMethod, 1, test_id=2)
self.assertEqual('Positional argument duplicated in kwargs: test_id',
self.assertEqual('Positional argument duplicated in kwargs: test_id',
msg)
def test_api_key_and_key_file_both_passed(self):
msg = self.assertRaises(AssertionError, MockAPI,
msg = self.assertRaises(AssertionError, MockAPI,
api_key='x', key_file='y')
self.assertEqual('Keys can be read from a file or passed, but not both.',
msg)
self.assertEqual(
'Keys can be read from a file or passed, but not both.', msg)
def test_logging_works(self):
self.api.log('foo')
self.api.log.assertLine('foo')
def test_log_at_startup(self):
self.api.log.assertLine('Creating v1 Etsy API, base url=http://host.')
class MockAPI_NoMethods(MockAPI):
def _get_methods(self, method_cache):
pass
class MethodTableCacheTests(Test):
def cache(self, method_cache=missing):
self.api = MockAPI_NoMethods('apikey')
self._cache = MethodTableCache(self.api, method_cache)
return self._cache
def test_uses_etsy_home_if_exists(self):
c = self.cache()
self.assertEqual(os.path.dirname(c.filename), self.scratch_dir)
def test_uses_temp_dir_if_no_etsy_home(self):
self.delete_scratch()
c = self.cache()
self.assertEqual(os.path.dirname(c.filename), tempfile.gettempdir())
def test_uses_provided_file(self):
fn = os.path.join(self.scratch_dir, 'foo.json')
self.assertEqual(self.cache(method_cache=fn).filename, fn)
def test_multiple_versions(self):
c = self.cache()
......@@ -297,96 +227,78 @@ class MethodTableCacheTests(Test):
self.assertNotEqual(MockAPI2('key').method_cache.filename, c.filename)
def get_uncached(self):
c = self.cache()
return c.get()
def test_no_cache_file_returns_results(self):
self.assertEqual(2, len(self.get_uncached()))
def test_no_cache_file_writes_cache(self):
self.get_uncached()
self.assertTrue(self._cache.wrote_cache)
def test_no_cache_file(self):
self.get_uncached()
self.assertFalse(self._cache.used_cache)
def get_cached(self):
c = self.cache()
c.get()
c = self.cache()
return c.get()
def test_caching(self):
self.get_cached()
self.assertTrue(self._cache.used_cache)
def test_caching_returns_results(self):
self.assertEqual(2, len(self.get_cached()))
def test_caching_doesnt_overwrite_cache(self):
self.get_cached()
self.assertFalse(self._cache.wrote_cache)
def make_old_cache(self):
self.get_cached()
fn = self._cache.filename
s = os.stat(fn)
os.utime(fn, (s.st_atime, s.st_mtime - 48*60*60))
os.utime(fn, (s.st_atime, s.st_mtime - 48 * 60 * 60))
def test_expired(self):
self.make_old_cache()
c = self.cache()
c.get()
self.assertFalse(c.used_cache)
def test_none_passed_does_not_cache(self):
self.get_cached()
c = self.cache(method_cache=None)
c.get()
self.assertFalse(c.used_cache)
def log_tester(self, method_cache=missing):
return MockAPI('key', method_cache=method_cache, log=MockLog(self))
def test_logs_when_not_using_cache(self):
api = self.log_tester(None)
api.log.assertLine('Not using cached method table.')
def test_logs_when_method_table_too_old(self):
self.make_old_cache()
self.log_tester().log.assertLine('Method table too old.')
def test_logs_when_reading_cache(self):
api = MockAPI('key')
self.log_tester().log.assertLine('Reading method table cache: %s' %
self.log_tester().log.assertLine('Reading method table cache: %s' %
api.method_cache.filename)
def test_logs_when_not_writing_new_cache(self):
api = self.log_tester(None)
api.log.assertLine(
'Method table caching disabled, not writing new cache.')
def test_logs_when_writing_new_cache(self):
t = self.log_tester()
t.log.assertLine('Wrote method table cache: %s' %
t.log.assertLine('Wrote method table cache: %s' %
t.method_cache.filename)
......@@ -10,28 +10,22 @@ class Test(TestCase):
scratch_dir = os.path.join(this_dir, 'scratch')
def setUp(self):
if not os.path.isdir(self.scratch_dir):
os.mkdir(self.scratch_dir)
def tearDown(self):
self.delete_scratch()
def delete_scratch(self):
if os.path.isdir(self.scratch_dir):
shutil.rmtree(self.scratch_dir)
def assertRaises(self, cls, f, *args, **kwargs):
try:
f(*args, **kwargs)
except cls, e:
except cls, e: # noqa
return e.message
else:
name = cls.__name__ if hasattr(cls, '__name__') else str(cls)
raise self.failureException, "%s not raised" % name
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment