Detailed Request and Response Example - ShipRight

API  INTEGRATION

This is the raw HTTP request using scenario 1 from the Examples Request Scenarios page, followed by an the response with explanation of changes.

POST https://api.shiprightsolutions.com/v1/order HTTP/1.1
User-Agent: Fiddler
SRS-ApiKey: 11111111-1111-1111-1111-111111111111
Content-type: application/json
Content-Length: 811

{
  "lineItems": [
    {
      "unitPrice": 1.01,			
      "itemCode": "COMP CHOCOLATES 1LB",		
      "quantity": 5					
    }							
  ],							
  "alternateOrderNumber": "scenario_1",			
  "ownerCode": "SR",					
  "orderClass": "DEFAULT",				
  "campaignCode": "DEF",				
  "orderTotal": 6.30,					
  "tax": 0,							
  "shippingAmount": 1.25,					
  "shipVia": "RG1",					
  "orderDate": "2014-05-29T16:00:00Z",			
  "orderSourceId": "5",					
  "shipToSameAsBillTo": true,				
  "orderedBy": {					
    "address": {					
      "email": "bilbo@bagend.com",	        
      "address1": "Bag End",			
      "address2": "165 Pleasant Avenue",		
      "city": "South Portland",				
      "region": "Me",					
      "country": "USA",					
      "postalCode": "04106"				
    },							
    "phones": [						
      {							
        "phoneType": "Mobile",				
        "countryCode": "123",				
        "areaCode": "987",				
        "phoneNumber": "1234567"			
      }							
    ],							
    "alternateCustomerNumber": "bilbo_1",		
    "title": "Mr",					
    "first": "Bilbo",				
    "middle": "",					
    "last": "Baggins"					
  },							
  "payment": {
    "paymentMethodCode": "I",
    "prePaid": true,
    "paymentInstrumentType": "INVOICE",
    "invoice": {
      "reference": "scenario_1"
    }
  }
}

Notable:

  • The post is made over HTTPS.
  • The API key is passed in a custom header, SRS-ApiKey.
  • The API is told that it’s getting post data as json via the content-type header.

Sample JSON response for scenario 1

Fields modified and added by the API on a successful POST are in red.

{
  "lineItems": [
    {
      "unitPrice": 1.01,
      "itemCode": "COMP CHOCOLATES 1LB",
      "quantity": 5
    }
  ],
  "orderId": 4162462,		      Internal SRS order identifier returned for informational purposes
  "invoiceNumber": 31646460,	      Internal SRS invoice identifier
  "alternateOrderNumber": "scenario_1",
  "ownerCode": "SR",
  "orderClass": "DEFAULT",
  "campaignCode": "DEF",
  "orderTotal": 6.30,
  "tax": 0,
  "shippingAmount": 1.25,
  "shipVia": "RG1",
  "orderDate": "2014-05-29T16:00:00Z",
  "orderSourceId": "5",
  "shipToSameAsBillTo": true,
  "orderedBy": {
    "address": {
      "standardized": true,	      Was the address successfully standardized? This can be used to update your 
                                      address information. Setting this to true by-passes the standardization step, 
                                      speeding up the POST response.
      "email": "bilbo@bagend.com",
      "address1": "BAG END",	      Note that the street address is placed in address2. See this.
      "address2": "165 PLEASANT AVE",
      "city": "S PORTLAND",
      "region": "ME",
      "country": "USA",
      "postalCode": "04106-6226"       Address standardization returns a 5+4 postal code for US addresses.
    },
    "phones": [
      {
        "countryCode": "1",
        "areaCode": "987",
        "phoneNumber": "1234567",
        "phoneType": "Mobile "
      }
    ],
    "customerId": 3309843,	       Internal SRS customer identifier
    "alternateCustomerNumber": "bilbo_1",
    "title": "Mr",
    "first": "Bilbo",
    "middle": "",
    "last": "Baggins",
    "fullName": "Bilbo Baggins"
  },
  "payment": {
    "paymentMethodCode": "I",
    "prePaid": true,
    "paymentInstrumentType": "INVOICE",
    "invoice": {
      "reference": "scenario_1"
    }
  }
}