Magento API details
Overview
This document has details of all the API integrated with MAGENTO 2.4 and above.
API Documentation
Understanding of APIs
Given the nature of software development, reasonable minor modifications are expected in future. Here are the clarifications on processes and APIs.
Proxy Flow | Channel API's | Channel API endpoints |
Get List of Orders | Lists orders that match specified search criteria.(based on filters for status and created_at time) | /rest/default/V1/orders |
Get an Order | Get order details for an order id | /rest/default/V1/orders/{orderId} |
Get Order status | Get status of a specific order | /rest/default/V1/orders/{id}/statuses |
Get Canceled orders List | Lists orders that match specified search criteria.(based on filters for status and updated_at time | /rest/default/V1/orders |
Order Acknowledgment | Change order status to processing as an acknowledgement of order received | rest/default/V1/orders/orders/{orderId}/comments |
Cancel order | Cancels a specified order. | /rest/default/V1/orders/{orderId}/cancel |
Create Shipment | Performs persist operations for a specified shipment. | /rest/default/V1/shipment/ |
Create Invoice | Create invoice on magento | /rest/default/V1/order/{orderId}/invoice |
Get Invoice | Get invoice details from magento based on the filter of order id | /rest/default/V1/invoices |
Get Shipment | Get shipping label | /rest/default/V1/shipment/{shipmentId} |
Create Manifest | No call to channel | null |
Get Manifest | No call to channel | null |
Update Inventory | Update the inventory of a specific sku | /rest/default/V1/products/{productSku}/stockItems/{itemId} |
Credential Api | Get access token | /rest/V1/integration/admin/token |
Return Orders | No call to channel(used to create a return order corresponding to a forward order in Increff Omni) | null |
Handover Orders | The order is handed over to the delivery partner marking the order complete at magento panel | /rest/default/V1/order/{orderId}/ship |
Fetch Orders
Get Orders: GET | /rest/default/V1/orders
Lists orders that match specified search criteria. This call returns an array of objects.
Order fetch is done based on search criteria with filters on fields, status and created_at time.These statuses are the order status when the order is created.
The items to be synced should have the product_type as simple.
The field method under payment should be cashondelivery for COD orders.
The increament_id will be used as the parent order id(will be displayed on invoice and shipping label) whereas, the internal order id(used to fetch order) will be used as the channel order id.
Request
QueryParams
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
|
|
|
|
Response
{
"items": [
{
"base_currency_code": "INR",
"base_discount_amount": 10.0,
"base_shipping_amount": 50.0,
"created_at": "2022-02-17 07:24:49",
"discount_amount": 50,
"entity_id": 11254,
"grand_total": 25980.0,
"discount_tax_compensation_amount": 10,
"increment_id": "M000013856",
"order_currency_code": "INR",
"shipping_amount": 60,
"status": "string",
"items": [
{
"base_original_price": 0,
"base_price": 0,
"base_price_incl_tax": 0,
"base_row_total": 0,
"base_row_total_incl_tax": 0,
"base_tax_amount": 0,
"discount_amount": 0,
"item_id": 0,
"name": "string",
"order_id": 0,
"original_price": 0,
"price": 0,
"price_incl_tax": 0,
"product_type": "simple",
"qty_canceled": 0,
"qty_ordered": 0,
"qty_refunded": 0,
"row_total_incl_tax": 0,
"sku": "string",
"tax_amount": 0,
"parent_item": {},
"product_option": {
"extension_attributes": {
"giftcard_item_option": {}
}
}
}
],
"billing_address": {
"city": "string",
"country_id": "string",
"email": "string",
"firstname": "string",
"lastname": "string",
"middlename": "string",
"postcode": "string",
"region": "string",
"street": [
"string"
],
"telephone": "string"
},
"payment": {
"method": "string"
},
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {
"city": "string",
"country_id": "string",
"email": "string",
"firstname": "string",
"lastname": "string",
"middlename": "string",
"postcode": "string",
"region": "string",
"street": [
"string"
],
"telephone": "string"
}
}
}
],
"cash_on_delivery_fee": 50.0,
"base_cash_on_delivery_fee": 60.0,
"amstorecredit_base_amount": 100.0,
"amstorecredit_amount": 120.0,
"applied_taxes": [
{
"code": "GST-18",
"title": "GST-18",
"percent": 18,
"amount": 3963.05,
"base_amount": 3963.05
}
],
"item_applied_taxes": [
{
"type": "product",
"item_id": 11593,
"applied_taxes": [
{
"code": "GST-18",
"title": "GST-18",
"percent": 18,
"amount": 3963.05,
"base_amount": 3963.05
}
]
}
]
}
}
]
}
HttpStatus : 200
Get Order Status:
GET | /rest/default/V1/orders/{id}/statuses
Gets the status for a specified order.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
“processing”
HttpStatus : 200
Order Acknowledgment
POST | rest/default/V1/orders/orders/{id}/comments
This call is made to acknowledge that the order is received in our system and to make the status of order processing in the magento panel(if not already in processing).
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
True
HttpStatus : 200
Get Canceled Orders
GET | /rest/default/V1/orders
Lists orders that match specified search criteria. This call returns an array of objects.
Order fetch is done based on search criteria with filters on fields, status and updated_at time.These statuses are the order status when the order is created.
The items to be synced should have the product_type as simple.
Request
QueryParams
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
|
|
|
|
Response
HttpStatus : 200
Cancel Order
POST | /rest/default/V1/orders/{id}/cancel
Cancels a specified order based on the order id of the order.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
True
HttpStatus : 200
Shipment
Create Invoice
POST | /rest/default/V1/order/{orderId}/invoice
This API call generates an invoice at magento for a specific order.
Note: This is not a mandatory call. For some clients the invoice generation on magento is done as soon as the order moves to processing status, so in cases in which such a job does not run at client end, this call generates invoice at magento, as without invoice generation, shipment creation cannot be done for magento.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
HttpStatus : 200
Get Invoice
GET | /rest/default/V1/invoices
This API call is used to get the invoice details for the specified order based on search criteria.
Request
QueryParams
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
|
|
|
|
Response
{
"items": [
{
"base_currency_code": "INR",
"base_discount_amount": 0,
"base_shipping_amount": 0,
"billing_address_id": 70058,
"created_at": "2022-07-29 09:00:05",
"discount_amount": 0,
"entity_id": 1,
"grand_total": 100,
"discount_tax_compensation_amount": 0,
"increment_id": "M000033958",
"order_id": 1,
"shipping_address_id": 1,
"shipping_amount": 0,
"store_to_base_rate": 0,
"store_to_order_rate": 0,
"subtotal": 100.0,
"subtotal_incl_tax": 100,
"tax_amount": 73.93,
"total_qty": 1,
"transaction_id": "pay_Jz7LmmJjjfMjPk",
"updated_at": "2022-07-29 09:00:05",
"items": [
{
"base_discount_tax_compensation_amount": 0,
"base_price": 690,
"base_price_incl_tax": 690,
"base_row_total": 616.07,
"base_row_total_incl_tax": 690,
"base_tax_amount": 73.93,
"description": "",
"entity_id": 167859,
"discount_tax_compensation_amount": 0,
"name": "Pack of 1 dress - off white",
"parent_id": 33958,
"price": 616.07,
"price_incl_tax": 690,
"product_id": 28618,
"row_total": 616.07,
"row_total_incl_tax": 690,
"sku": "8907095618689",
"tax_amount": 73.93,
"order_item_id": 172596,
"qty": 1
}
],
"comments": []
}
],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "order_id",
"value": "1",
"condition_type": "eq"
}
]
}
]
},
"total_count": 1
}
HttpStatus : 200
Create Shipment
POST | /rest/default/V1/shipment/
Performs persist operation for a specified shipment
Request
{
"entity": {
"created_at": "2022-11-30 12:28:00",
"order_id": 46773,
"items": [
{
"sku": "8907095853998",
"order_item_id": 235211,
"qty": 2
}
],
"tracks": [
{
"order_id": 46773,
"created_at": "2022-11-30 12:28:00",
"parent_id": 46773,
"weight": 1,
"qty": 1,
"description": "",
"track_number": "11704910415542",
"title": "Delhivery",
"carrier_code": "11704910415542"
}
],
"comments": [
{
"is_customer_notified": 0,
"parent_id": 0,
"comment": "comment",
"is_visible_on_front": 0,
"created_at": "2022-11-30 12:28:00",
}
]
}
}
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.comments[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Entity.items[]
|
|
|
|
|
|
|
|
|
|
|
|
Entity.tracks[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Response
HttpStatus : 200
Get Shipment
GET | /rest/default/V1/shipment/{id}
Loads a specified shipment.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
HttpStatus : 200
Update Inventory
PUT | /rest/default/V1/products/{productSku}/stockItems/{itemId}
This API will push the inventory count to the channel.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
Request Body
Name | Type | Mandatory | Comments |
|
|
|
|
|
|
|
|
|
|
|
|
Response
32380(entity id)
HttpStatus : 200
Handover
POST | /rest/default/V1/order/{orderId}/ship
This API marks the order complete in magento.
Request
Path parameter
Name | Type | Mandatory | Comments |
|
|
|
|
Response
2568 ( Handover ID)
HttpStatus : 200
Create Return Order
Inbound | POST | /return/return-orders
Summary
This API is used to create B2C return orders in Omni.
Description
This API is used to create B2C return orders in Omni. One order item represents only one quantity of an SKU. If there are multiple quantities of the same SKU then multiple order items should be created.
Request
Parameter Name | Data Type | Description | Mandatory |
| String | Forward order code for which return order is being created. This will be the entity_id of the forward order created in Increff Omni | yes |
| String | This is a unique identifier provided by the channel to identify the return order | yes |
| String | Location code of the warehouse where the return order will be received. This is the location code of order in Increff Omni. | yes |
| String | Time at which return order got placed by customer. This should be in the format as mentioned | no |
| String | The Status of the return order | no |
| String | Expected date of return | no |
| Object[] | Array of order items, order items represent each line of return order. | yes |
| String | This is a unique identifier provided by the channel to identify the return order item. | yes |
| String | Reason for return as given by the customer. | yes |
| String | Boolean value - true/false | yes |
| String | SKU code for return order item. | yes |
| String | Name of the product | Conditional Yes* |
| String | Brand of the product | Conditional Yes*† |
| String | Color of the product | Conditional Yes*† |
| String | Category of the product | Conditional Yes*† |
| String | Sub Category of the product | Conditional Yes*† |
| String | Serial number of the product | Conditional Yes*† |
| Double | Price of the product | Conditional Yes* |
| Double | Final amount paid for the product | Conditional Yes* |
| String | Image url of the product | No |
| Double | Store credits for this line item | No |
| Object[] | List of sub tax items object | Conditional Yes*† |
| String | Type of tax applicable | Conditional Yes*† |
| Double | Tax rate for this tax type | Conditional Yes*† |
| Double | Tax applicable for this type of tax per unit | Conditional Yes*† |
| Double | Total tax for this tax type | Conditional Yes*† |
| String | Type of return. Possible values - SELF_SHIP,CUSTOMER_RETURN,RETURN_TO_ORIGIN | Conditional Yes* |
| String | Courier tracking number. | If courier partner integration done via Increff, then can be ignored. (Otherwise YES) |
| String | Courier partner name. | If courier partner integration done via Increff, then can be ignored.
(Otherwise YES) |
| String | Currency | Conditional Yes* |
| String | Can take two values:INDIAN and INTERNATIONAL, specifying the region type of order | Conditional Yes* |
| String | Seller GSTIN. If logisticAggregatorType=CLICKPOST, then this field is mandatory. If logisticAggregatorType=SHIPROCKET, then this field can be null | Conditional Yes* |
| String | Consignee GSTIN | Conditional Yes*† |
| String | The reason due to which the order was returned | Conditional Yes* |
| Object | Package Dimensions | Conditional Yes* |
| Double | Breadth of package. Default value can be set as 1 | yes |
| Double | Height of package. Default value can be set as 1 | yes |
| Double | Length of package. Default value can be set as 1 | yes |
| Doubke | Weight of package. Default value can be set as 200 | yes |
| Object | Shipping Address (Warehouse address) | Conditional Yes* |
| String | Name of Warehouse POC | Yes |
| String | 1st line of warehouse’s address | Yes |
| String | 2nd line of warehouse’s address | No |
| String | 3rd line of warehouse’s address | No |
| String | City of Warehouse | Yes |
| String | State of Warehouse | Yes |
| String | ZIP/Pin code of Warehouse | Yes |
| String | Country of warehouse | Yes |
| String | Email of warehouse | Yes |
| String | Phone Number of warehouse POC | Yes |
| Object | Billing address of the customer | Conditional Yes* |
| String | Name of customer | Yes |
| String | 1st line of customer’s address | Yes |
| String | 2nd line of customer’s address | No |
| String | 3rd line of customer’s address | No |
| String | City of customer | Yes |
| String | State of customer | Yes |
| String | ZIP/Pin code of customer | Yes |
| String | Country of customer | Yes |
| String | Email of customer | Yes |
| String | Phone Number of customer | Yes |
| Object | Order Details | Conditional Yes* |
| Double | If order is of type COD, then this should be greater than 0 | Yes |
| String | Invoice Id of the order. If logisticAggregatorType=CLICKPOST, then this field is mandatory. If logisticAggregatorType=SHIPROCKET, then this field can be null | Conditional yes* |
| String | Invoice Time of the order. If logisticAggregatorType=CLICKPOST, then this field is mandatory. If logisticAggregatorType=SHIPROCKET, then this field can be null | Conditional yes* |
| Double | Invoice value | Yes |
| Boolean | True if the order is of COD type | Yes |
| String | Forward Shipment Number | No |
*→ These fields are mandatory if courier partner integration needs to be done via Increff(ie. in cases where the channel does not have the AWB and transporter details and wants increff to fetch these details through the integration between increff and logistic aggregator)
*† → These fields are dependant on the Courier partner being integrated with, if it is mandatory for the courier partner, then they must be sent.
Response
Empty Body
HttpStatus : 200
Return Order Ack
Outbound | PUT | {Client’s URL}
Summary
This API will call the channel with return order processing details.
Description
This API will call the channel with return order processing details.This API will only get triggered after the return order is received and processed.
Request
Parameter Name | Data Type | Description | Mandatory |
| String | Unique code used by the channel to identify the return order | yes |
| String | ForwardOrderCode associated with the return order | yes |
| String | Location code of the warehouse where the return order will be received. | yes |
| Object[] | List of return items processed. | yes |
| String | Unique code used by the channel to identify the return order item | yes |
| String | SKU code of return order item | yes |
| String | The reason due to which this return item has been marked qc fail | no |
| String | The qcStatus of the return Item. Possible values : PASS , FAIL | yes |
| String[] | It contains the list of urls of the images of the return items .It will only be populated in case that item has been marked as fail. | no |
Response
Empty body
HttpStatus : 200
Pushing Notifications to Magento front-end system
Outbound | POST | {Client’s URL}
Summary
This API will push notifications to the client’s system.
Description
This API will push notifications to the client’s systems. Notifications can be of the forward order statuses or it can be of return orders. These notifications pushed can be from both Clickpost and/or Shiprocket (based on the configuration).
Request (Forward Order Notification Payload)
The above request is a sample notification for a forward order notification.
Request (Return Order Notification Payload)
The above request is a sample notification payload for a return order notification. The return order details will be found in the returnOrderInfo object.
Parameter Name | Data Type | Description | Mandatory |
| String | Forward Order Code | yes |
| String | Forward Shipment Code | no |
| Long | Epoch timestamp at which notification was received from channel |
|
| String | Forward AWB for the order. If the notification is of forward order, this field would be present. | Conditional yes |
| String | The type of notification that is being sent. The possible values are listed below. | yes |
| Object | Return Order Information. Will be present if the notification type is a return type(AWB_GENERATED, RETURN_PICKUP, RTO etc.) | Conditional yes |
| String | Return Order Id | Conditional yes |
| String | Return Awb | Conditional yes |
| String | Courier for the return order | Conditional yes |
| Long | Return Order Time | Conditional yes |
| Object | This contains the custom fields sent by Clickpost/Shiprocket | yes |
| String | Logistic Aggregator type. Can be CLICKPOST or SHIPROCKET | yes |
| Object | Map of extra information that are passed to us by logistic aggregators. Example - Account Code, Security Key etc. in Clickpost’s case | yes |
| String | Warehouse Code for the forward/return order. If the shipping label was generated through MiniOMS, then this field would be populated. | Conditional yes |
| Objects | The items for the forward/return order. Would be null in case of shiprocket forward order statuses | Conditional yes |
| String | Item Id | Conditional yes |
| String | SKU of the item | Conditional yes |
| Integer | Quantity of the item | Conditional yes |
Request (Invoice Notification Payload)
The above request is a sample notification payload for invoice generated notification. This notification will be sent when Invoice is generated in our system. The invoice document details will be found in the PushInvoice
object.
Parameter Name | Data Type | Description | Mandatory |
| String | Id of the generated invoice | yes |
| String | Url of invoice document | yes |
| String | Status of invoice | yes |
| String | Invoice/Credit note | yes |
| String | Forward Shipment Code | yes |
| String | Forward Order Code | yes |
| NotificationType | The type of notification that is being sent. The possible values are listed below. | yes |
| Long | Epoch timestamp at which notification was received from channel | yes |
Notification Type
The following are the types of notifications that can be sent to the client’s system
Notification Type | Applicable for | Description |
| Clickpost | Shipping Label has been generated |
| Clickpost,Shiprocket | Courier is out to pick up the shipment |
| Clickpost | Courier has picked up the return order |
| Clickpost,Shiprocket | Courier is out to deliver the shipment |
| Clickpost | shipment could not be delivered ( e.g. address not found, person not available) |
| Clickpost,Shiprocket | Shipment delivered successfully |
| Clickpost,Shiprocket | Shipment could not be delivered and the shipment is now being sent back to its origin/Warehouse |
| Clickpost | Customer has placed the return order
|
| Clickpost | AWB is generated for the shipment |
| Clickpost,Shiprocket | Shipment has been canceled (e.g customer cancellation) |
| Clickpost,Shiprocket | Shipment delivered to origin |
| Clickpost | fwd order picked up from warehouse to exchange against the return order |
| Clickpost | Return order picked up, fwd order delivered |
| Clickpost | shipment from warehouse canceled |
| Clickpost | Shipment is stuck in transit |
| Clickpost | Shipment not delivered on time |
| Clickpost,Shiprocket | Shipment lost in transit |
| Clickpost,Shiprocket | Shipment damaged in transit |
| Shiprocket | Invoice for shipment has been generated |
| Shiprocket | Shipment Label has been generated |
| Shiprocket | Shipment pick up has been scheduled and pick request is sent to courier partner |
| Shiprocket | Shipment dispatched from the Warehouse |
| Shiprocket |
|
| Shiprocket |
|
| Shiprocket | Shipment is in queue for pickup post shipment pickup was scheduled |
| Shiprocket | Pick up is rescheduled |
| Shiprocket | An order for which there is some error in pick up generation |
| Shiprocket | Cancellation has been requested for the order |
| Shiprocket | Shipment is in transit |
| Shiprocket | Shipment could not be delivered in first attempt. |
| Shiprocket | Shipment is delayed but within SLA |
| Shiprocket |
|
| Shiprocket |
|
| Shiprocket |
|
| Shiprocket | During transit shipment reached from one HUB to final HUB before delivering to customer |
| Shiprocket | Shipment sent to wrong route |
| Clickpost,Shiprocket | Shipment picked up from the warehouse |
| Shiprocket | An order for which RTO is acknowledged by seller |
| Clickpost |
|
FAQs
Que: How can I identify if the notification is for a forward order or a return order?
Ans: If the “returnOrderInfo“ field is null, then it is a forward order notification. If it is not null, it is a return order notification.
Nuances
Shipment
The required by time of Increff OMS(SLA) is set as 2 days from the time at which the order is created at channel.
Shipping Label
Shipping labels are generated by RMS.
The customer address details will not be changed after order creation.(If needed in case of a pin code not serviceable from clickpost)it should be raised and then will be changed from the database.
A set of default dimensions will be sent to the logistic aggregator(non configurable)
Invoice
Signature and logo png file to be provided by the client which further needs to be stored in the system.(By default increff logo is used in invoice)
From party location contact name will be shown in the from to address in invoice
The invoice will include item level discount(which is populated from magento in the discount field of the get order response payload)
The total discount will be shown in the invoice (it can also include the store credit if it is present in amstorecredit_amount inside the extension_attributes of the order response payload).
The cash on delivery fee is added to the shipping charge in case it is present in the field cash_on_delivery_fee inside the extension_attributes of order.
HSN code will be visible under Item tax code/HSN code
The pdf format supported is A4 size.
Two options for invoice creation: channel or RMS.
Channel
Tax breakup to be provided by the channel under the item_applied_tax object of the get order response(Invoice pdf creation will be based on these details). The code, percentage and amount will be visible in the invoice. The code should be IGST/CGST/SGST.
Logo png file to be provided by the client which further needs to be stored in the system.
RMS
Logistic Aggregator type to be selected from CLICKPOST, SHIPROCKET, SHIPWAY
The Invoice prefix and series(Integer) to be provided by client
Updates
Multi-warehousing support in Magento- 13-May-23
Introduced multi-warehousing support through our advanced order splitting and routing capabilities. This means that we can now split and route all orders to different locations mapped to the client-channel pair, providing seamless fulfillment across multiple locations.
As Magento does not support multi-warehousing and does not split orders based on location, we have implemented this functionality to support multi-warehousing.
All the orders will be split based on the selected logic of splitting and routing