Fulfillment API
(ms.fulfillment)

Fields

orderDetailsorderDetails of the requested order
shipping_methodshipping method used for shipping (shippo, fedex, aramex, etc)
zip_codezip code for the city
codcash on delievery-true/false
levellevel1 or level2 for fulfillment method
pincodepincode of the city wher you want your order to be delivered
provider_nameName of the shipping service provider (fedex, aramex, etc)
pickupAddressAddress from where pickup of items will be done
shipping_addressshipping address is where you want your items delivered
Get Notifications GET /api/1/entity/ms.fulfillment/_/getNotifications

This method fetches logistics related notifications that are to be displayed to the user

Example

Fetching logistics notifications
GET api/1/entity/ms.fulfillment/_/getNotifications

Example Response Json

[
  {
    "_id": "570cde054038a6cd69b1b386",
    "message": "All the DTDC pickups can only be created before 12 pm for that day, so please schedule accordingly.",
    "provider": "dtdc",
    "level": "warning",
    "created_on": "2016-04-12T11:37:41.364Z",
    "_created_by": "560b7ff059d8db0245760110",
    "updated_on": "2016-04-26T07:38:30.062Z",
    "_updated_by": "56cd8c8d209328f17a42fe90"
  },
  {
    "_id": "56d81e4eb4df857159a61a19",
    "message": "Rates given by the selected method are tentative based on the given order information and might differ based on actual parameters.",
    "level": "info",
    "created_on": "2016-03-03T11:21:50.876Z",
    "_created_by": "560b7ff059d8db0245760110",
    "updated_on": "2016-04-12T11:46:04.738Z",
    "_updated_by": "560b7ff059d8db0245760110"
  }
]
Get Methods GET /api/1/entity/ms.fulfillment/_/getMethods

This method fetches the fulfillment_methods enabled for a store

Example

Fetching fulfillment methods applicable for a store
GET /api/1/entity/ms.fulfillment/_/getMethods

Example Response Json

[
  {
    "_id": "58ecc6b3ca2c9c70043418ea",
    "provider": "fedex",
    "handler": "function(req, res, next) { var fedex = require('ms-fedex')({\"developer_key\":\"8xd5F61w5rZb3EMJ\",\"account_number\":\"510087100\",\"meter_number\":\"118799392\",\"password\":\"1qvKpcGVFJk5dofUREbixMz56\",\"tin_no\":\"123245634\",\"is_test_key\":true}); next(null, fedex); }",
    "status": "enable",
    "app_id": "566e7504a664fce3317afbf0",
    "shipping_level": "level1"
  },
  {
    "_id": "58da53c251ae665114d42436",
    "provider": "ecomexpress",
    "handler": "function(req, res, next) { var ecomexpress = require('ms-ecomexpress')({\"username\":\"ecomexpress\",\"password\":\"Ke$3c@4oT5m6h#$\",\"testing\":true}); next(null, ecomexpress); }",
    "status": "enable",
    "app_id": "578cb43457d063741a8a248d",
    "shipping_level": "level1"
  },
  {
    "_id": "58da533e51ae665114d42321",
    "provider": "shippo",
    "handler": "function(req, res, next) { var shippo = require('ms-shippo')({access_key: req.store._id.toString()}); next(null, shippo); }",
    "status": "enable",
    "app_id": "5433deeae45163c51df4091f",
    "shipping_level": "level2",
    "settings": {},
    "created_on": "2017-03-28T12:12:46.258Z",
    "_created_by": "58a554ccf678c0dc20b1144e"
  }
]
Get Rates GET /api/1/entity/ms.fulfillment/_/getRates

This method fetches rates depending upon the order details, source and destination of the shipment and the logistics provider choosen

Example

Fetching logistics rates for an order
GET /api/1/entity/ms.fulfillment/_/getRates

Example Request Json

{
  "orderDetail": {
    "_id": "57dbb73cd593ea345ddcc98d",
    "items": [
      {
        "_id": "57db7ce3e42b47a115e533f6",
        "name": "ppp",
        "product_id": "573d4b352e6910c3589bc34b",
        "metafields": {"location_based_prices": []},
        "weight": "10",
        "linked_product_id": null,
        "price": "100.00",
        "quantity": 2,
        "total": 100
      }
    ],
    "sub_total": 5100,
    "total": 5100,
    "item_count": "2",
    "email": "sumit.yadav@hippoinnovations.com",
    "shipping_address": {
      "country": "IN",
      "full_name": "yadav",
      "address": "Spaze I tech Park",
      "city": "gurgaon",
      "state": "Haryana",
      "zip": "122001",
      "phone": "9876543210"
    },
    "order_id": "OID806",
    "payment_status": "paid",
    "return": false
  },
  "method": "bluedart",
  "pickupAddress": {
    "_id": "56331a518be63bee21b1467b",
    "title": "Test Store",
    "address": "Store Hippo",
    "city": "Gurgaon",
    "state": "Haryana",
    "country": "India",
    "zip_code": "122001",
    "phone": "1234567890",
    "email": "sumit.yadav@hippoinnovations.com",
  },
  "level": "level1"
}

Example Response Json

[
  {
    "name": "DTDC_Surface",
    "rate": "201.35",
    "title": "DTDC_Surface",
    "method": "regular"
  },
  {
    "name": "DTDC_Surface",
    "rate": "315.45",
    "title": "DTDC_Surface",
    "method": "cod"
  },
  {
    "name": "DTDC_Express",
    "rate": "37.29",
    "title": "DTDC_Express",
    "method": "regular"
  },
  {
    "name": "DTDC_Express",
    "rate": "151.08",
    "title": "DTDC_Express",
    "method": "cod"
  }
]

Query Parameters

CodeMessage
levelLevel of fulfillment method used to ship the order
methodName of fulfillment methods used
orderDetailDetails of the order, that is to be shipped. It includes items, shipping_address, order total, etc
pickupAddressAddress of the pickup location of the shipment
Check Pickup Availability GET /api/1/entity/ms.fulfillment/_/checkPickupAvailability

This method returns the possible dates and timings for whcih the pickup can be scheduled.

Example

Getting DTDC available pickup timings
GET

Example Request Json

{
  "orderDetail": {
    "_id": "57dbb73cd593ea345ddcc98d",
    "items": [
      {
        "_id": "57db7ce3e42b47a115e533f6",
        "name": "ppp",
        "product_id": "573d4b352e6910c3589bc34b",
        "metafields": {"location_based_prices": []},
        "weight": "10",
        "linked_product_id": null,
        "price": "100.00",
        "quantity": 2,
        "total": 100
      }
    ],
    "sub_total": 5100,
    "total": 5100,
    "item_count": "2",
    "email": "sumit.yadav@hippoinnovations.com",
    "shipping_address": {
      "country": "IN",
      "full_name": "yadav",
      "address": "Spaze I tech Park",
      "city": "gurgaon",
      "state": "Haryana",
      "zip": "122001",
      "phone": "9876543210"
    },
    "order_id": "OID806",
    "payment_status": "paid",
    "return": false
  },
  "method": "bluedart",
  "pickupAddress": {
    "_id": "56331a518be63bee21b1467b",
    "title": "Test Store",
    "address": "Store Hippo",
    "city": "Gurgaon",
    "state": "Haryana",
    "country": "India",
    "zip_code": "122001",
    "phone": "1234567890",
    "email": "sumit.yadav@hippoinnovations.com",
  },
  "level": "level1",
   "provider_name": "DTDC_Express"
}

Example Response Json

{
  "dates": [
    {
      "PickupDate": "2016-09-20",
      "CutOffTime": "1:00:00"
    }
  ],
  "timings": [],
  "timings2": [
    "7:00",
    "8:00",
    "9:00",
    "10:00",
    "11:00",
    "12:00"
  ],
  "cutoff": {
    "cutoffTime": "1:00:00"
  }
}

Query Parameters

CodeMessage
levelLevel of fulfillment method used to ship the order
methodName of fulfillment methods used
orderDetailDetails of the order, that is to be shipped. It includes items, shipping_address, order total, etc
pickupAddressAddress of the pickup location of the shipment
provider_nameName of the particular service provider eg: delhivery
Create Pickup POST /api/1/entity/ms.fulfillment/_/createPickup

This method registers a pickup request with the selected logistics service provider

Example

Creating a pickup
POST /api/1/entity/ms.fulfillment/_/createPickup

Example Request Json

{
  "orderDetail": {
    "_id": "57dbb73cd593ea345ddcc98d",
    "items": [
      {
        "_id": "57db7ce3e42b47a115e533f6",
        "name": "ppp",
        "product_id": "573d4b352e6910c3589bc34b",
        "weight": "10",
        "quantity": 2,
        "total": 100
      }
    ],
    "sub_total": 200,
    "total": 200,
    "item_count": "2",
    "email": "sumit.yadav@hippoinnovations.com",
    "shipping_address": {
      "country": "IN",
      "full_name": "yadav",
      "address": "Spaze I tech Park",
      "city": "gurgaon",
      "state": "Haryana",
      "zip": "122001",
      "phone": "9876543210"
    },
    "order_id": "OID806",
    "return": false
  },
  "method": "dtdc",
  "pickupAddress": {
    "_id": "56331a518be63bee21b1467b",
    "title": "Test Store",
    "address": "Store Hippo",
    "city": "Gurgaon",
    "state": "Haryana",
    "country": "India",
    "zip_code": "122001",
    "phone": "1234567890",
    "email": "sumit.yadav@hippoinnovations.com",
    "created_on": "2015-10-30T07:20:51.879Z",
    "_created_by": "5497b4fec6270c5843b2dae6",
    "updated_on": "2016-04-14T08:21:04.713Z",
    "_updated_by": "55a5fdbca4a9ace237720ab8"
  },
  "level": "level1",
  "provider_name": "DTDC_Express",
  "selected_date": {
    "readyPickup": "2016-09-19",
    "cutofftime": "6:00:00"
  },
  "selected_time": "16:00",
  "selected_service": {
    "name": "DTDC_Express",
    "rate": "151.08",
    "title": "DTDC_Express",
    "method": "cod"
  }
}

Query Parameters

CodeMessage
levelLevel of fulfillment method used to ship the order
methodName of fulfillment methods used
orderDetailDetails of the order, that is to be shipped. It includes items, shipping_address, order total, etc
pickupAddressAddress of the pickup location of the shipment
provider_nameName of the particular service provider eg:delhivery
selected_serviceDetails of selected fulfillment service and rate
selected_dateselected date to schedule pickup
selected_timeselected time to schedule pickup
Check Delivery Availability GET /api/1/entity/ms.fulfillment/_/checkDeliveryAvailability

This method returns if delivery (cod, regular or both) is possible for a given destination pincode

Example

Checking delivery availability for a given pincode
GET /api/1/entity/ms.fulfillment/_/checkDeliveryAvailability

Example Request Json

{"pincode":"712124"}

Example Response

both

Query Parameters

CodeMessage
pincodePincode for which delivery availability is to be checked
Track Shipment GET /api/1/entity/ms.fulfillment/_/trackShipment

This method returns the tracking details of a given AWB (tracking) number

Example

Tracking a shipment
GET /api/1/entity/ms.fulfillment/_/trackShipment

Example Request Json

{
"tracking_number":"42225048666"
}

Example Response Json

{
  "data": "{\"Transaction\":null,\"Notifications\":{},\"HasErrors\":false,\"TrackingResults\":{\"KeyValueOfstringArrayOfTrackingResultmFAkxlpY\":{\"Key\":\"42225048666\",\"Value\":{\"TrackingResult\":[{\"WaybillNumber\":\"42225048666\",\"UpdateCode\":\"SH313\",\"UpdateDescription\":\"Pickup Cancelled\",\"UpdateDateTime\":\"2016-09-17T18:06:00\",\"UpdateLocation\":\"Gurgaon, India\",\"Comments\":\"\",\"ProblemCode\":\"\"},{\"WaybillNumber\":\"42225048666\",\"UpdateCode\":\"SH308\",\"UpdateDescription\":\"Pickup Scheduled\",\"UpdateDateTime\":\"2016-09-17T15:49:00\",\"UpdateLocation\":\"Gurgaon, India\",\"Comments\":\"\",\"ProblemCode\":\"\"},{\"WaybillNumber\":\"42225048666\",\"UpdateCode\":\"SH014\",\"UpdateDescription\":\"Record created.\",\"UpdateDateTime\":\"2016-09-16T16:09:00\",\"UpdateLocation\":\"Gurgaon, India\",\"Comments\":\"\",\"ProblemCode\":\"\"}]}}}}",
  "tracking_status": "Pickup Cancelled",
  "shipped_by": "Aramex",
  "tracking_data": [
    {
      "date": "2016-09-17T18:06:00",
      "description": "Pickup Cancelled",
      "location": "Gurgaon, India",
      "comment": ""
    },
    {
      "date": "2016-09-17T15:49:00",
      "description": "Pickup Scheduled",
      "location": "Gurgaon, India",
      "comment": ""
    },
    {
      "date": "2016-09-16T16:09:00",
      "description": "Record created.",
      "location": "Gurgaon, India",
      "comment": ""
    }
  ],
  "service": "shippo"
}

Query Parameters

CodeMessage
tracking_numberTracking number associated with the shipment, whose tracking details are to be returned
Create Return Pickup POST /api/1/entity/ms.fulfillment/_/createReturnPickup

This method registers a return pickup request with the selected logistics service provider.

This method internally calls the same command as 
/api/1/entity/ms.fulfillment/_/createPickup but since the permission for returning a shipment should only be given to admin and not sellers, /api/1/entity/ms.fulfillment/_/createReturnPickup was created separately with permission exclusively to admin 

Example

Creating return pickup of an order
POST /api/1/entity/ms.fulfillment/_/createReturnPickup

Example Request Json

{
  "orderDetail": {
    "_id": "57dbb73cd593ea345ddcc98d",
    "items": [
      {
        "_id": "57db7ce3e42b47a115e533f6",
        "name": "ppp",
        "product_id": "573d4b352e6910c3589bc34b",
        "weight": "10",
        "quantity": 2,
        "total": 100
      }
    ],
    "sub_total": 200,
    "total": 200,
    "item_count": "2",
    "email": "sumit.yadav@hippoinnovations.com",
    "shipping_address": {
      "country": "IN",
      "full_name": "yadav",
      "address": "Spaze I tech Park",
      "city": "gurgaon",
      "state": "Haryana",
      "zip": "122001",
      "phone": "9876543210"
    },
    "order_id": "OID806",
    "return": true
  },
  "method": "dtdc",
  "pickupAddress": {
    "_id": "56331a518be63bee21b1467b",
    "title": "Test Store",
    "address": "Store Hippo",
    "city": "Gurgaon",
    "state": "Haryana",
    "country": "India",
    "zip_code": "122001",
    "phone": "1234567890",
    "email": "sumit.yadav@hippoinnovations.com",
    "created_on": "2015-10-30T07:20:51.879Z",
    "_created_by": "5497b4fec6270c5843b2dae6",
    "updated_on": "2016-04-14T08:21:04.713Z",
    "_updated_by": "55a5fdbca4a9ace237720ab8"
  },
  "level": "level1",
  "provider_name": "DTDC_Express",
  "selected_date": {
    "readyPickup": "2016-09-19",
    "cutofftime": "6:00:00"
  },
  "selected_time": "16:00",
  "selected_service": {
    "name": "DTDC_Express",
    "rate": "151.08",
    "title": "DTDC_Express",
    "method": "cod"
  }
}

Query Parameters

CodeMessage
levelLevel of fulfillment method used to ship the order
methodName of fulfillment methods used
orderDetailDetails of the order, that is to be shipped. It includes items, shipping_address, order total, etc
pickupAddressAddress of the pickup location of the shipment
provider_nameName of the particular service provider eg:delhivery
selected_serviceDetails of selected fulfillment service and rate
selected_dateselected date to schedule pickup
selected_timeselected time to schedule pickup