Skip to content

api2cart/bash-sdk

Repository files navigation

API2Cart OpenAPI Bash client

Overview

This is a Bash client script for accessing API2Cart OpenAPI service.

The script uses cURL underneath for making all REST calls.

Usage

# Make sure the script has executable rights
$ chmod u+x 

# Print the list of operations available on the service
$ ./ -h

# Print the service description
$ ./ --about

# Print detailed information about specific operation
$ ./ <operationId> -h

# Make GET request
./ --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
 -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make POST request
$ echo '<body_content>' |  --host <hostname> --content-type json <operationId> -

# Make POST request with simple JSON content, e.g.:
# {
#   "key1": "value1",
#   "key2": "value2",
#   "key3": 23
# }
$ echo '<body_content>' |  --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -

# Make POST request with form data
$  --host <hostname> <operationId> key1:=value1 key2:=value2 key3:=23

# Preview the cURL command without actually executing it
$  --host http://<hostname>:<port> --dry-run <operationid>

Docker image

You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:

docker build -t my-rest-client .
docker run -it my-rest-client

By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.

Shell completion

Bash

The generated bash-completion script can be either directly loaded to the current Bash session using:

source .bash-completion

Alternatively, the script can be copied to the /etc/bash-completion.d (or on OSX with Homebrew to /usr/local/etc/bash-completion.d):

sudo cp .bash-completion /etc/bash-completion.d/

OS X

On OSX you might need to install bash-completion using Homebrew:

brew install bash-completion

and add the following to the ~/.bashrc:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Zsh

In Zsh, the generated _ Zsh completion file must be copied to one of the folders under $FPATH variable.

Documentation for API Endpoints

All URIs are relative to /v1.1

Class Method HTTP request Description
AccountApi accountCartAdd POST /account.cart.add.json account.cart.add
AccountApi accountCartList GET /account.cart.list.json account.cart.list
AccountApi accountConfigUpdate PUT /account.config.update.json account.config.update
AccountApi accountFailedWebhooks GET /account.failed_webhooks.json account.failed_webhooks
AccountApi accountSupportedPlatforms GET /account.supported_platforms.json account.supported_platforms
AttributeApi attributeAdd POST /attribute.add.json attribute.add
AttributeApi attributeAssignGroup POST /attribute.assign.group.json attribute.assign.group
AttributeApi attributeAssignSet POST /attribute.assign.set.json attribute.assign.set
AttributeApi attributeAttributesetList GET /attribute.attributeset.list.json attribute.attributeset.list
AttributeApi attributeCount GET /attribute.count.json attribute.count
AttributeApi attributeDelete DELETE /attribute.delete.json attribute.delete
AttributeApi attributeGroupList GET /attribute.group.list.json attribute.group.list
AttributeApi attributeInfo GET /attribute.info.json attribute.info
AttributeApi attributeList GET /attribute.list.json attribute.list
AttributeApi attributeTypeList GET /attribute.type.list.json attribute.type.list
AttributeApi attributeUnassignGroup POST /attribute.unassign.group.json attribute.unassign.group
AttributeApi attributeUnassignSet POST /attribute.unassign.set.json attribute.unassign.set
AttributeApi attributeUpdate PUT /attribute.update.json attribute.update
AttributeApi attributeValueAdd POST /attribute.value.add.json attribute.value.add
AttributeApi attributeValueDelete DELETE /attribute.value.delete.json attribute.value.delete
AttributeApi attributeValueUpdate PUT /attribute.value.update.json attribute.value.update
BasketApi basketInfo GET /basket.info.json basket.info
BasketApi basketItemAdd POST /basket.item.add.json basket.item.add
BasketApi basketLiveShippingServiceCreate POST /basket.live_shipping_service.create.json basket.live_shipping_service.create
BasketApi basketLiveShippingServiceDelete DELETE /basket.live_shipping_service.delete.json basket.live_shipping_service.delete
BasketApi basketLiveShippingServiceList GET /basket.live_shipping_service.list.json basket.live_shipping_service.list
BatchApi batchJobList GET /batch.job.list.json batch.job.list
BatchApi batchJobResult GET /batch.job.result.json batch.job.result
BridgeApi bridgeDelete POST /bridge.delete.json bridge.delete
BridgeApi bridgeDownload GET /bridge.download.file bridge.download
BridgeApi bridgeUpdate POST /bridge.update.json bridge.update
CartApi cartCatalogPriceRulesCount GET /cart.catalog_price_rules.count.json cart.catalog_price_rules.count
CartApi cartCatalogPriceRulesList GET /cart.catalog_price_rules.list.json cart.catalog_price_rules.list
CartApi cartCouponAdd POST /cart.coupon.add.json cart.coupon.add
CartApi cartCouponConditionAdd POST /cart.coupon.condition.add.json cart.coupon.condition.add
CartApi cartCouponCount GET /cart.coupon.count.json cart.coupon.count
CartApi cartCouponDelete DELETE /cart.coupon.delete.json cart.coupon.delete
CartApi cartCouponList GET /cart.coupon.list.json cart.coupon.list
CartApi cartDelete DELETE /cart.delete.json cart.delete
CartApi cartGiftcardAdd POST /cart.giftcard.add.json cart.giftcard.add
CartApi cartGiftcardCount GET /cart.giftcard.count.json cart.giftcard.count
CartApi cartGiftcardDelete DELETE /cart.giftcard.delete.json cart.giftcard.delete
CartApi cartGiftcardList GET /cart.giftcard.list.json cart.giftcard.list
CartApi cartInfo GET /cart.info.json cart.info
CartApi cartMetaDataList GET /cart.meta_data.list.json cart.meta_data.list
CartApi cartMetaDataSet POST /cart.meta_data.set.json cart.meta_data.set
CartApi cartMetaDataUnset DELETE /cart.meta_data.unset.json cart.meta_data.unset
CartApi cartMethods GET /cart.methods.json cart.methods
CartApi cartPluginList GET /cart.plugin.list.json cart.plugin.list
CartApi cartScriptAdd POST /cart.script.add.json cart.script.add
CartApi cartScriptDelete DELETE /cart.script.delete.json cart.script.delete
CartApi cartScriptList GET /cart.script.list.json cart.script.list
CartApi cartShippingZonesList GET /cart.shipping_zones.list.json cart.shipping_zones.list
CartApi cartValidate GET /cart.validate.json cart.validate
CategoryApi categoryAdd POST /category.add.json category.add
CategoryApi categoryAddBatch POST /category.add.batch.json category.add.batch
CategoryApi categoryAssign POST /category.assign.json category.assign
CategoryApi categoryCount GET /category.count.json category.count
CategoryApi categoryDelete DELETE /category.delete.json category.delete
CategoryApi categoryDeleteBatch POST /category.delete.batch.json category.delete.batch
CategoryApi categoryFind GET /category.find.json category.find
CategoryApi categoryImageAdd POST /category.image.add.json category.image.add
CategoryApi categoryImageDelete DELETE /category.image.delete.json category.image.delete
CategoryApi categoryInfo GET /category.info.json category.info
CategoryApi categoryList GET /category.list.json category.list
CategoryApi categoryUnassign POST /category.unassign.json category.unassign
CategoryApi categoryUpdate PUT /category.update.json category.update
CustomerApi customerAdd POST /customer.add.json customer.add
CustomerApi customerAddressAdd POST /customer.address.add.json customer.address.add
CustomerApi customerAttributeList GET /customer.attribute.list.json customer.attribute.list
CustomerApi customerCount GET /customer.count.json customer.count
CustomerApi customerDelete DELETE /customer.delete.json customer.delete
CustomerApi customerFind GET /customer.find.json customer.find
CustomerApi customerGroupAdd POST /customer.group.add.json customer.group.add
CustomerApi customerGroupList GET /customer.group.list.json customer.group.list
CustomerApi customerInfo GET /customer.info.json customer.info
CustomerApi customerList GET /customer.list.json customer.list
CustomerApi customerUpdate PUT /customer.update.json customer.update
CustomerApi customerWishlistList GET /customer.wishlist.list.json customer.wishlist.list
MarketplaceApi marketplaceProductFind GET /marketplace.product.find.json marketplace.product.find
OrderApi orderAbandonedList GET /order.abandoned.list.json order.abandoned.list
OrderApi orderAdd POST /order.add.json order.add
OrderApi orderCalculate POST /order.calculate.json order.calculate
OrderApi orderCount GET /order.count.json order.count
OrderApi orderFinancialStatusList GET /order.financial_status.list.json order.financial_status.list
OrderApi orderFulfillmentStatusList GET /order.fulfillment_status.list.json order.fulfillment_status.list
OrderApi orderInfo GET /order.info.json order.info
OrderApi orderList GET /order.list.json order.list
OrderApi orderPreestimateShippingList POST /order.preestimate_shipping.list.json order.preestimate_shipping.list
OrderApi orderRefundAdd POST /order.refund.add.json order.refund.add
OrderApi orderReturnAdd POST /order.return.add.json order.return.add
OrderApi orderReturnDelete DELETE /order.return.delete.json order.return.delete
OrderApi orderReturnUpdate PUT /order.return.update.json order.return.update
OrderApi orderShipmentAdd POST /order.shipment.add.json order.shipment.add
OrderApi orderShipmentAddBatch POST /order.shipment.add.batch.json order.shipment.add.batch
OrderApi orderShipmentDelete DELETE /order.shipment.delete.json order.shipment.delete
OrderApi orderShipmentInfo GET /order.shipment.info.json order.shipment.info
OrderApi orderShipmentList GET /order.shipment.list.json order.shipment.list
OrderApi orderShipmentTrackingAdd POST /order.shipment.tracking.add.json order.shipment.tracking.add
OrderApi orderShipmentUpdate PUT /order.shipment.update.json order.shipment.update
OrderApi orderStatusList GET /order.status.list.json order.status.list
OrderApi orderTransactionList GET /order.transaction.list.json order.transaction.list
OrderApi orderUpdate PUT /order.update.json order.update
ProductApi productAdd POST /product.add.json product.add
ProductApi productAddBatch POST /product.add.batch.json product.add.batch
ProductApi productAttributeList GET /product.attribute.list.json product.attribute.list
ProductApi productAttributeValueSet POST /product.attribute.value.set.json product.attribute.value.set
ProductApi productAttributeValueUnset POST /product.attribute.value.unset.json product.attribute.value.unset
ProductApi productBrandList GET /product.brand.list.json product.brand.list
ProductApi productChildItemFind GET /product.child_item.find.json product.child_item.find
ProductApi productChildItemInfo GET /product.child_item.info.json product.child_item.info
ProductApi productChildItemList GET /product.child_item.list.json product.child_item.list
ProductApi productCount GET /product.count.json product.count
ProductApi productCurrencyAdd POST /product.currency.add.json product.currency.add
ProductApi productCurrencyList GET /product.currency.list.json product.currency.list
ProductApi productDelete DELETE /product.delete.json product.delete
ProductApi productDeleteBatch POST /product.delete.batch.json product.delete.batch
ProductApi productFind GET /product.find.json product.find
ProductApi productImageAdd POST /product.image.add.json product.image.add
ProductApi productImageDelete DELETE /product.image.delete.json product.image.delete
ProductApi productImageUpdate PUT /product.image.update.json product.image.update
ProductApi productInfo GET /product.info.json product.info
ProductApi productList GET /product.list.json product.list
ProductApi productManufacturerAdd POST /product.manufacturer.add.json product.manufacturer.add
ProductApi productOptionAdd POST /product.option.add.json product.option.add
ProductApi productOptionAssign POST /product.option.assign.json product.option.assign
ProductApi productOptionDelete DELETE /product.option.delete.json product.option.delete
ProductApi productOptionList GET /product.option.list.json product.option.list
ProductApi productOptionValueAdd POST /product.option.value.add.json product.option.value.add
ProductApi productOptionValueAssign POST /product.option.value.assign.json product.option.value.assign
ProductApi productOptionValueDelete DELETE /product.option.value.delete.json product.option.value.delete
ProductApi productOptionValueUpdate PUT /product.option.value.update.json product.option.value.update
ProductApi productPriceAdd POST /product.price.add.json product.price.add
ProductApi productPriceDelete DELETE /product.price.delete.json product.price.delete
ProductApi productPriceUpdate PUT /product.price.update.json product.price.update
ProductApi productReviewList GET /product.review.list.json product.review.list
ProductApi productStoreAssign POST /product.store.assign.json product.store.assign
ProductApi productTaxAdd POST /product.tax.add.json product.tax.add
ProductApi productUpdate PUT /product.update.json product.update
ProductApi productUpdateBatch POST /product.update.batch.json product.update.batch
ProductApi productVariantAdd POST /product.variant.add.json product.variant.add
ProductApi productVariantAddBatch POST /product.variant.add.batch.json product.variant.add.batch
ProductApi productVariantDelete DELETE /product.variant.delete.json product.variant.delete
ProductApi productVariantDeleteBatch POST /product.variant.delete.batch.json product.variant.delete.batch
ProductApi productVariantImageAdd POST /product.variant.image.add.json product.variant.image.add
ProductApi productVariantImageDelete DELETE /product.variant.image.delete.json product.variant.image.delete
ProductApi productVariantPriceAdd POST /product.variant.price.add.json product.variant.price.add
ProductApi productVariantPriceDelete DELETE /product.variant.price.delete.json product.variant.price.delete
ProductApi productVariantPriceUpdate PUT /product.variant.price.update.json product.variant.price.update
ProductApi productVariantUpdate PUT /product.variant.update.json product.variant.update
ProductApi productVariantUpdateBatch POST /product.variant.update.batch.json product.variant.update.batch
ReturnApi returnActionList GET /return.action.list.json return.action.list
ReturnApi returnCount GET /return.count.json return.count
ReturnApi returnInfo GET /return.info.json return.info
ReturnApi returnList GET /return.list.json return.list
ReturnApi returnReasonList GET /return.reason.list.json return.reason.list
ReturnApi returnStatusList GET /return.status.list.json return.status.list
SubscriberApi subscriberList GET /subscriber.list.json subscriber.list
TaxApi taxClassInfo GET /tax.class.info.json tax.class.info
TaxApi taxClassList GET /tax.class.list.json tax.class.list
WebhookApi webhookCount GET /webhook.count.json webhook.count
WebhookApi webhookCreate POST /webhook.create.json webhook.create
WebhookApi webhookDelete DELETE /webhook.delete.json webhook.delete
WebhookApi webhookEvents GET /webhook.events.json webhook.events
WebhookApi webhookList GET /webhook.list.json webhook.list
WebhookApi webhookUpdate PUT /webhook.update.json webhook.update

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

StoreKeyAuth

  • Type: API key
  • API key parameter name: x-store-key
  • Location: HTTP header

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors