This library is no longer supported by ChannelEngine. To build your own library via OpenAPI Generator, using your programming language of choice, check out the Merchant API: API clients article in our Help Center.
ChannelEngine’s APIs follow the OpenAPI/Swagger specifications, which you can find in our API reference.
For detailed information on ChannelEngine’s APIs, go to the REST APIs category in our Help Center.
Python 3.6+
If the python package is hosted on Github, you can install directly from Github
pip install channelengine-merchant-api-client
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import channelengine_merchant_api_client
Please refer to https://demo.channelengine.net/api/swagger
from channelengine_merchant_api_client import ApiClient, OrderApi, ProductApi, OfferApi, ReturnApi, Configuration
from channelengine_merchant_api_client.rest import ApiException
from pprint import pprint
from datetime import datetime
from dateutil.relativedelta import relativedelta
def main():
# Configure API key authorization: apikey
config = Configuration()
config.api_key['apikey'] = 'xxxxxxxxxx'
config.host = 'https://demo.channelengine.net/api'
client = ApiClient(config)
# create an instance of the API class
order_api = OrderApi(client)
product_api = ProductApi(client)
offer_api = OfferApi(client)
return_api = ReturnApi(client)
try:
# Merchant: Update offer
offer = [{'MerchantProductNo': 'ABC123', 'Stock': '98'}]
pprint(offer_api.offer_stock_price_update(offer))
# Merchant: Get returns
two_years_ago = datetime.now() - relativedelta(years=2)
returns = return_api.return_get_declared_by_channel(two_years_ago)
pprint(returns)
# Merchant: Get new orders
new_orders = order_api.order_get_new()
pprint(new_orders)
# Merchant: Get product by MPN
product = product_api.product_get_by_merchant_product_no('ABC123')
pprint(product)
except ApiException as e:
print("Exception when calling API: %s\n" % e)
if __name__ == '__main__':
main()