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:
importchannelengine_merchant_api_clientPlease refer to https://demo.channelengine.net/api/swagger
fromchannelengine_merchant_api_clientimportApiClient, OrderApi, ProductApi, OfferApi, ReturnApi, Configurationfromchannelengine_merchant_api_client.restimportApiExceptionfrompprintimportpprintfromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltadefmain():
# Configure API key authorization: apikeyconfig=Configuration()
config.api_key['apikey'] ='xxxxxxxxxx'config.host='https://demo.channelengine.net/api'client=ApiClient(config)
# create an instance of the API classorder_api=OrderApi(client)
product_api=ProductApi(client)
offer_api=OfferApi(client)
return_api=ReturnApi(client)
try:
# Merchant: Update offeroffer= [{'MerchantProductNo': 'ABC123', 'Stock': '98'}]
pprint(offer_api.offer_stock_price_update(offer))
# Merchant: Get returnstwo_years_ago=datetime.now() -relativedelta(years=2)
returns=return_api.return_get_declared_by_channel(two_years_ago)
pprint(returns)
# Merchant: Get new ordersnew_orders=order_api.order_get_new()
pprint(new_orders)
# Merchant: Get product by MPNproduct=product_api.product_get_by_merchant_product_no('ABC123')
pprint(product)
exceptApiExceptionase:
print("Exception when calling API: %s\n"%e)
if__name__=='__main__':
main()