Skip to main content

Magento API Reference

The SDLC Magento 2 Connector communicates with Magento through its REST API. This page documents the API endpoints used by the connector and the fallback logic employed for reliability.

Authentication

All API calls use the Integration Access Token configured on the Magento instance. The token is sent as a Bearer token in the HTTP Authorization header:

Authorization: Bearer <access_token>

API Endpoints

The connector uses the following Magento REST API endpoints:

Product Endpoints

MethodEndpointDescription
GET/rest/V1/productsRetrieve a list of products with filtering
GET/rest/V1/products/:skuRetrieve a single product by SKU
POST/rest/V1/productsCreate a new product
PUT/rest/V1/products/:skuUpdate an existing product
GET/rest/V1/products/attributes/sets/listRetrieve attribute sets

Customer Endpoints

MethodEndpointDescription
GET/rest/V1/customers/searchSearch and retrieve customers
GET/rest/V1/customers/:customerIdRetrieve a single customer
POST/rest/V1/customersCreate a new customer
PUT/rest/V1/customers/:customerIdUpdate an existing customer

Category Endpoints

MethodEndpointDescription
GET/rest/V1/categoriesRetrieve the category tree
GET/rest/V1/categories/:categoryIdRetrieve a single category
POST/rest/V1/categoriesCreate a new category
PUT/rest/V1/categories/:categoryIdUpdate a category

Order Endpoints

MethodEndpointDescription
GET/rest/V1/ordersRetrieve a list of orders with filtering
GET/rest/V1/orders/:orderIdRetrieve a single order
POST/rest/V1/ordersCreate a new order
PUT/rest/V1/orders/:orderIdUpdate an order

Invoice Endpoints

MethodEndpointDescription
GET/rest/V1/invoicesRetrieve invoices
POST/rest/V1/order/:orderId/invoiceCreate an invoice for an order

Shipment Endpoints

MethodEndpointDescription
GET/rest/V1/shipmentsRetrieve shipments
POST/rest/V1/order/:orderId/shipCreate a shipment for an order

Credit Memo Endpoints

MethodEndpointDescription
GET/rest/V1/creditmemosRetrieve credit memos
POST/rest/V1/order/:orderId/refundCreate a credit memo/refund

Inventory Endpoints

MethodEndpointDescription
GET/rest/V1/stockItems/:productSkuGet stock information for a product
PUT/rest/V1/products/:sku/stockItems/:itemIdUpdate stock for a product

API Fallback Logic

The connector implements a robust fallback strategy to handle API failures gracefully:

  1. Retry on Timeout -- If an API call times out, the connector retries up to 3 times with exponential backoff (1s, 2s, 4s).
  2. Batch Processing -- Large datasets are processed in batches to avoid API rate limits and memory issues.
  3. Partial Sync -- If individual records fail, the connector continues processing remaining records and logs the errors.
  4. Token Refresh -- If a 401 Unauthorized response is received, the connector logs an error indicating the access token may have expired.
  5. Graceful Degradation -- If a non-critical API endpoint is unavailable, the connector skips that data type and continues with other sync operations.

API Rate Limits

Magento 2 does not enforce strict API rate limits by default, but your hosting provider or custom configuration may impose limits. The connector handles rate limiting by:

  • Processing records in configurable batch sizes
  • Implementing delays between large batch operations
  • Logging 429 Too Many Requests responses as retry-able errors
warning

If you encounter frequent 429 errors, increase the sync interval or contact your Magento hosting provider to adjust rate limits.

API Debugging

To debug API communication:

  1. Enable Odoo's developer mode.
  2. Check the Odoo server log for API request/response details.
  3. Review the Sync Reports for error messages.
  4. Use a tool like Postman to test the Magento API directly with your access token.
tip

The Magento API returns detailed error messages in the response body. Check the Sync Reports error details for the full API error message.

Next Steps