Magento 2 API Products & Order Options

This article contains the list of options required to set-up both the product and order piece, for a Magento 2 connection via API.

To build out the connection, receive the Magento 2 credentials from the client & Intelligent reach credentials from our system, and provide them to the merchops team.

Options

Shared Options:

  • Magento2BaseUrl: domain of site i.e. https://www.domain.com.au/
  • Magento2StoreView: [optional] will be added to URL here "/rest{storeView}V1"
  • Magento2AuthSignature: [optional] authorisation algo to use - defaults to "HMAC-SHA1", but we have used "HMAC-SHA256"

Authentication

Authentication can either be by OAuth (recommended) or username

Oauth:

  • Magento2ConsumerKey
  • Magento2ConsumerSecret
  • Magento2AccessToken
  • Magento2TokenSecret

Username:

  • Magento2Username
  • Magento2Password

Feed Options

  • Magento2ProductApiPageSize: [optional] Page size for products.  Defaults to 300.  Only change if Magento instance is slow.
  • Magento2InventoryApiPageSize: [optional] Page size for inventory.  Defaults to 300.  Only change if Magento instance is slow.
  • Magento2GetCategoryPageSize: [optional] Page size for categories.  Defaults to 300.  Only change if Magento instance is slow.
  • Magento2GetProductAttributePageSize: [optional] Page size for product attributes.  Defaults to 300.  Only change if Magento instance is slow.
Inventory can be pulled either by using "V1/stockItems/lowStock" or "V1/inventory/dump-stock-index-data/website/base".  The formal is default, but the latter is apparently the new way to do it.
lowStock:
Magento doesn't allow us to get delta updates of inventory - they have a method that returns all inventory that is below a certain threshold.  So we run two azure functions - one runs a few times per day (see recommended timings at the end), and likely gets all inventory, the other runs frequently , and gets low stock items so should returna  lot less.
  • Magento2RealTimeInventoryLowStockQtyCeiling: [optional] When calculating low stock in real time, we only get items with stock less than this (so its quicker).  Defaults to 10
  • Magento2FullInventoryLowStockQtyCeiling: [optional] When calculating low stock in real time, we only get items with stock less than this (so its quicker).  Defaults to 10000000
inventory dump:
  • UseInventoryDumpStock: true uses the "new" inventory dump method

Order Options

Magento2MarketplaceOrderApiKey: API Key from IR system

Magento2MarketplaceOrderSecretKey: API Secret from IR system

Magento2MarketplaceOrderSubscriptionKey: IR Api Gateway subscription key

FeedNameToCustomerGroupIdMapping: [optional] allows mapping from our feed name to CustomerGroupId in the order.  Format is {feed name}::{customer group id};;etc

Magento2CustomerIsGuest: [optional] whether to make all orders guest checkout, or assign against user (via email address)

Magento2DeliveryShippingMethod: [optional] shipping.method to send in order

Magento2InStorePickupShippingMethod: [optiona] shipping.method to send in order if Instore Pickup.

Magento2StandardShippingMethod: [optional] shipping_description to send in order, if not specified it will send the ShippingService in the IR order.

Magento2StoreId: [optional] store_id to send in order.

Magento2StoreName: [optional] store_name to send in order

Magento2OrderStatus: [optional] status to send in order. Defaults to "processing"

Magento2OrderState: [optional] state to send in order. Defaults to "processing"

StoreIdToNameMapping: [optional] Mapping to change storeId from IR order into store name.  This is used in click & collect orders and modifies the shipping_description field.  Defaults to storeID of not specified.  Format is {storeId}::{outputName};;etc

CustomExtensionAttributeMapping: [optional] Values in here are added to entity.extension_attribute to send in order. Format is {key}::{value};;etc

Magento2CurrencyCode: [optional] *_currency_code to send in order.  Defaults to AUD

Magento2CreateInvoice: [optional] Whether to create invoice with order. Defaults to false.

Magento2FeedTypeToStoreView: [optional] allows changing storeview based on Feed Name.  {feed name}::{store view};;etc.  If not specified will use Magento2StoreView if setup.

Magento2AllowOrderRefund: [optional] Whether to process refunds from IR (not all marketplaces support refunds yet).  Defaults to true.

Magento2GetOrdersPageSize: [optional] Sets page size to get orders back.  Defaults to 300

AddDeliveryNoteAsOrderComment: [optional] Whether to add delivery not as an Order Comment.  Defaults to false.  Delivery notes are always added to customer_note in IR.

Magento2LogOrders: [optional] whether to log orders to Azure logger - please be aware of GDPR issues around using this.  Defaults to false

Magento Access Setup

The client will also need to provide access to the following areas in Magento:

Sales
Catalog
Carts
Customers

Recommended Sync Times

Full Inventory Feed: every 4 hours
Order Sync: every 5 minutes
Product Feed (delta): every 5 minutes
Real Time Inventory Feed (delta): every 15minutes