Order Create

Allows customers to create a new logistics order in the WMS. The id value in the result can be used for further update and delete operations. Required fields are in bold text.

Access

To access to Mainfreight APIs, you have to Register

Resource URI

Make an HTTP POST request to:

https://api.mainfreight.com/logistics/1.0/customers/order

Resource Information

TypeValue 
Authentication API Key  
Response Formats JSON / XML  
HTTP Methods POST  
API Version 1.0  

HTTP Headers

You must add the following HTTP Headers to your request:

HeaderDescriptionTypeRequired
Content-Type Request content type. Supported types are "application/json" or "application/xml" string Yes
Authorization

The word " Secret" followed by a space, then your unique Logistics API Key

e.g: Secret wdnOId93-VXZECxvVRPQEJZNxPB5XZ...

string Yes

Parameters

You have to provide the parameters marked as required:

Request Parameters

ParameterDescriptionTypeLengthRequired
references List of References associated with the order to help identify unique orders array   Yes
referenceType Reference type, list of available types can be found here string 50 Yes
value Reference value string 50 Yes
parties List of parties associated with the order, e.g. sender, receiver etc. array   Yes
partyType Type of party, list of available types can be found here string 50 Yes
code Shorthand code to identify the party string 50 Yes
displayName The display name for the party, usually relates to Receiver, SoldTo string 50  
address1 Street address string 50  
address2 Additional street address details string 50  
suburb Suburb for the party address string 50  
postCode PostCode/Zip for the party address string 50  
place City/Place for the party address string 50  
state State for the party address string 50  
country Country for the party address string 50  
notes List of notes that can be identified in our system array    
noteType Note type, list of available of types can be found here string 50  
value Value to appear against the note string 50-500  
serviceProvider The service provider that will transport the order object    
displayName The name of the service provider, e.g. Mainfreight string 50  
serviceLevel The required service levels for service providers object    
displayName The name of service level, e.g. Next Day string 50  
orderType Order type list of available of types can be found here string 50  
repCode General purpose use field, discuss usage with the integration team string 50  
repName General purpose use field, discuss usage with the integration team string 50  
requiredDate Required date that order needs to be dispatched by
Format yyyy-MM-dd
date   Yes
etaDate Estimated date that order will be dispatched by
Format yyyy-MM-dd
date    
miscCharge Miscellaneous charge amount for the order decimal    
freightCharge Freight charge amount for the order decimal    
taxAmount Tax amount charge for the order decimal    
pallets Number of pallets required for the order integer    
weight Total weight for the order decimal    
volume Total volume for the order decimal    
invoicedNetAmount Invoiced amount charge for the order decimal    
signedBy Signed by value for the order string 50  
vipEmailAddress VIP email notification email address string 500  
customStockStatusCode Custom stock status code, discuss usage with the integration team string 50  
isUrgent Indicates that the order should be dispatched with urgent priority boolean    
isDutyFree Indicates that the order is shipped as duty free boolean    
isTimeslotRequired Indicates that a timeslot is required for delivery in relation to the booking time boolean    
bookingFromDateTime Booking from date used for booking with Mainfreight Transport
Format yyyy-MM-dd HH:mm:ss
dateTime    
bookingToDateTime Booking to date used for booking with Mainfreight Transport
Format yyyy-MM-dd HH:mm:ss
dateTime    
bookingReference Booking reference value string 20  
bookingComment Booking comment value string 50  
isCallRequired Indicates that a call is required to confirm the booking time boolean    
orderLines List of products related to this order array   Yes
lineNo Number identifying the order in your order integer   Yes
units Number of units for this product decimal   Yes
backOrderUnits Number of back order units integer    
retailPrice Retail price for ordered product decimal    
discountPrice Discount price for ordered product decimal    
costPrice Cost price for ordered product decimal    
extendedPrice Extended price for ordered product decimal    
miscChargeAmount Miscellaneous charge amount for ordered product decimal    
miscChargeDisplayName Miscellaneous charge display name string 50  
receiverStockCode Receiver product code string 50  
receiverStockDisplayName Receiver product description string 50  
packType Pack type ordered for product string 50  
weight Weight for product decimal    
volume Volume for product decimal    
contingencyPrice Contingency price for product decimal    
freightClass Freight class code for product list of available codes can be found here string 6  
product   object   Yes, if kitset not provided
code Product code
When providing a product code as well as a kitset code, all products for the kitset
should be provided with the correct ratios
string 50 Yes
displayName Product description, only required if configured to automatically create new products string 50 Conditional
alternativeDisplayName Alternative product description string 50  
kitset   object   Yes, if product not provided
code Kitset code identifying the kitset.
When providing a kitset code, product code is optional
string 50 Yes
attributes List of available attributes available for products array    
attributeType Attribute type, list of available attribute types can be found here string 50  
value Attribute value
Date type attributes must have a format yyyy-MM-dd
string, date 50  
note   object    
value Value for the note to appear against the line string 250  

Response Parameters

ParameterDescriptionTypeLength 
id Order identifier that can be used to update and delete this order guid 36  
references List of References associated with the order to help identify unique orders array    
referenceType Reference type, list of available types can be found here string 50  
value Reference value string 50  
parties List of parties associated with the order, e.g. sender, receiver etc. array    
partyType Type of party, list of available types can be found here string 50  
code Shorthand code to identify the party string 50  
displayName The display name for the party, usually relates to Receiver, SoldTo string 50  
address1 Street address string 50  
address2 Additional street address details string 50  
suburb Suburb for the party address string 50  
postCode PostCode/Zip for the party address string 50  
place City/Place for the party address string 50  
state State for the party address string 50  
country Country for the party address string 50  
notes List of notes that can be identified in our system array    
noteType Note type, list of available of types can be found here string 50  
value Value to appear against the note string 50  
serviceProvider The service provider that will transport the order object    
displayName The name of the service provider, e.g. Mainfreight string 50  
serviceLevel The required service levels for service providers object    
displayName The name of service level, e.g. Next Day string 50  
orderType Order type list of available of types can be found here string 50  
repCode General purpose use field, discuss usage with the integration team string 50  
repName General purpose use field, discuss usage with the integration team string 50  
requiredDate Required date that order needs to be dispatched by
Format yyyy-MM-dd
date    
etaDate Estimated date that order will be dispatched by
Format yyyy-MM-dd
date    
miscCharge Miscellaneous charge amount for the order decimal    
freightCharge Freight charge amount for the order decimal    
taxAmount Tax amount charge for the order decimal    
pallets Number of pallets required for the order integer    
weight Total weight for the order decimal    
volume Total volume for the order decimal    
invoicedNetAmount Invoiced amount charge for the order decimal    
signedBy Signed by value for the order string 50  
vipEmailAddress VIP email notification email address string 500  
customStockStatusCode Custom stock status code, discuss usage with the integration team string 50  
isUrgent Indicates that the order should be dispatched with urgent priority boolean    
isDutyFree Indicates that the order is shipped as duty free boolean    
isTimeslotRequired Indicates that a timeslot is required for delivery in relation to the booking time boolean    
bookingFromDateTime Booking from date used for booking with Mainfreight Transport
Format yyyy-MM-dd HH:mm:ss
dateTime    
bookingToDateTime Booking to date used for booking with Mainfreight Transport
Format yyyy-MM-dd HH:mm:ss
dateTime    
bookingReference Booking reference value string 20  
bookingComment Booking comment value string 50  
isCallRequired Indicates that a call is required to confirm the booking time boolean    
orderLines List of products related to this order array    
lineNo Number identifying the order in your order string 50  
units Number of units for this product decimal    
backOrderUnits Number of back order units integer    
retailPrice Retail price for ordered product decimal    
discountPrice Discount price for ordered product decimal    
costPrice Cost price for ordered product decimal    
extendedPrice Extended price for ordered product decimal    
miscChargeAmount Miscellaneous charge amount for ordered product decimal    
miscChargeDisplayName Miscellaneous charge display name string 50  
receiverStockCode Receiver product code string 50  
receiverStockDisplayName Receiver product description string 50  
packType Pack type ordered for product string 50  
weight Weight for product decimal    
volume Volume for product decimal    
contingencyPrice Contingency price for product decimal    
freightClass Freight class code for product list of available codes can be found here string 6  
product   object    
code Product code
When providing a product code as well as a kitset code, all products for the kitset
should be provided with the correct ratios
string 50  
displayName Product description, only required if configured to automatically create new products string 50  
alternativeDisplayName Alternative product description string 50  
kitset   object    
code Kitset code identifying the kitset.
When providing a kitset code, product code is optional
string 50  
attributes List of available attributes available for products array    
attributeType Attribute type, list of available attribute types can be found here string 50  
value Attribute value
Date type attributes must have a format yyyy-MM-dd
string, date 50  
note   object    
value Value for the note to appear against the line string 250  

Code samples

JSON Example

To Create an Order in JSON format you will need to POST a JSON object:

  • URL
< > grab code
https://api.mainfreight.com/logistics/1.0/customers/order

You are going to send a JSON object similar to this:

  • REQUEST JSON
< > grab code
{
	"references": [{
			"referenceType": "OurReference",
			"value": "{OurReference}"
		},
		{
			"referenceType": "YourReceiverReference",
			"value": "{YourReceiverReference}"
		}
	],
	"parties": [{
			"partyType": "Warehouse",
			"code": "{WarehouseCode}"
		}, 
		{		
			"partyType": "Customer",
			"code": "{CustomerCode}"
		}, 
		{
			"partyType": "Receiver",
			"code": "1234",
			"displayName": "Consignee ABCD",
			"address1": "111",
			"address2": "222",
			"suburb": "NEWTON",
			"postCode": "1010",
			"place": "AUCKLAND",
			"state": null,
			"country": "New Zealand",
			"phone": null
		}, 
		{
			"partyType": "SoldTo",
			"code": "1723",
			"displayName": "Consignee ABCD",
			"address1": "111",
			"address2": null,
			"suburb": "NEWTON",
			"postCode": null,
			"place": "AUCKLAND",
			"state": null,
			"country": "New Zealand",
			"phone": null
		}
	],
	"notes": [{
			"noteType": "Comment1",
			"value": "Comment1"
		}, 
		{
			"noteType": "DeliveryInstructions",
			"value": "DeliveryInstructions"
		}
	],
	"serviceProvider": {
		"displayName": "Mainfreight",
		"serviceLevel": {
			"displayName": "Metro"
		}
	},
	"orderType": "N",
	"requiredDate": "2018-05-31",
	"etaDate": "2018-06-02",
	"orderLines": [{
			"lineNo": "1",
			"units": 2,
			"product": {
				"code": "{ProductCode}",
				"displayName": "{ProductDescription}"
			},
			"attributes": [{
					"attributeType": "Grade1",
					"value": "Grade1"
				},
				{
					"attributeType": "ExpiryDate",
					"value": "2018-05-31"
				}
			],
			"note": {
				"value": "Line Notes"
			}
		}
	]
}

You are going get another JSON object similar to this:

  • RESPONSE JSON
< > grab code
{
	"id": "00000000-0000-0000-0000-000000000000",
	"references": [{
			"referenceType": "OurReference",
			"value": "{OurReference}"
		},
		{
			"referenceType": "YourReceiverReference",
			"value": "{YourReceiverReference}"
		}
	],
	"parties": [{
			"partyType": "Warehouse",
			"code": "{WarehouseCode}"
		}, 
		{		
			"partyType": "Customer",
			"code": "{CustomerCode}"
		}, 
		{
			"partyType": "Receiver",
			"code": "1234",
			"displayName": "Consignee ABCD",
			"address1": "111",
			"address2": "222",
			"suburb": "NEWTON",
			"postCode": "1010",
			"place": "AUCKLAND",
			"state": null,
			"country": "New Zealand",
			"phone": null
		}, 
		{
			"partyType": "SoldTo",
			"code": "1723",
			"displayName": "Consignee ABCD",
			"address1": "111",
			"address2": null,
			"suburb": "NEWTON",
			"postCode": null,
			"place": "AUCKLAND",
			"state": null,
			"country": "New Zealand",
			"phone": null
		}
	],
	"notes": [{
			"noteType": "Comment1",
			"value": "Comment1"
		}, 
		{
			"noteType": "DeliveryInstructions",
			"value": "DeliveryInstructions"
		}
	],
	"serviceProvider": {
		"displayName": "Mainfreight",
		"serviceLevel": {
			"displayName": "Metro"
		}
	},
	"orderType": "N",
	"requiredDate": "2018-05-31",
	"etaDate": "2018-06-02",
	"orderLines": [{
			"lineNo": "1",
			"units": 2,
			"product": {
				"code": "{ProductCode}",
				"displayName": "{ProductDescription}"
			},
			"attributes": [{
					"attributeType": "Grade1",
					"value": "Grade1"
				},
				{
					"attributeType": "ExpiryDate",
					"value": "2018-05-31"
				}
			],
			"note": {
				"value": "Line Notes"
			}
		}
	]
}

XML Example

To Create an Order in XML format, you will need to POST XML object.

  • URL
< > grab code
https://api.mainfreight.com/logistics/1.0/customers/order

You are going to send XML document similar to this:

  • XML REQUEST
< > grab code
<order>
   <references>
      <reference>
         <referenceType>OurReference</referenceType>
         <value>{OurReference}</value>
      </reference>
      <reference>
         <referenceType>YourReceiverReference</referenceType>
         <value>{YourReceiverReference}</value>
      </reference>
   </references>
   <parties>
      <party>
         <code>{WarehouseCode}</code>
         <partyType>Warehouse</partyType>
      </party>
      <party>
         <code>{CustomerCode}</code>
         <partyType>Customer</partyType>
      </party>
      <party>
         <address1>111</address1>
         <address2>222</address2>
         <code>1234</code>
         <country>New Zealand</country>
         <displayName>Consignee ABCD</displayName>
         <partyType>Receiver</partyType>
         <phone />
         <place>AUCKLAND</place>
         <postCode>1010</postCode>
         <state />
         <suburb>NEWTON</suburb>
      </party>
      <party>
         <address1>111</address1>
         <address2 />
         <code>1723</code>
         <country>New Zealand</country>
         <displayName>Consignee ABCD</displayName>
         <partyType>SoldTo</partyType>
         <phone />
         <place>AUCKLAND</place>
         <postCode />
         <state />
         <suburb>NEWTON</suburb>
      </party>
   </parties>
   <etaDate>2018-06-02</etaDate>
   <orderType>N</orderType>
   <requiredDate>2018-05-31</requiredDate>
   <serviceProvider>
      <displayName>Mainfreight</displayName>
      <serviceLevel>
         <displayName>Metro</displayName>
      </serviceLevel>
   </serviceProvider>
   <notes>
      <note>
         <noteType>Comment1</noteType>
         <value>Comment1</value>
      </note>
      <note>
         <noteType>DeliveryInstructions</noteType>
         <value>def</value>
      </note>
   </notes>
   <orderLines>
      <orderLine>
         <attributes>
            <attribute>
               <attributeType>Grade1</attributeType>
               <value>Grade1</value>
            </attribute>
            <attribute>
               <attributeType>ExpiryDate</attributeType>
               <value>2018-05-31</value>
            </attribute>
         </attributes>
         <lineNo>1</lineNo>
         <note>
            <value>Product Line</value>
         </note>
         <product>
            <code>{ProductCode}</code>
            <displayName>{ProductDescription}</displayName>
         </product>
         <units>2</units>
      </orderLine>
   </orderLines>
</order>

You are going to get a XML document similar to this:

  • XML RESPONSE
< > grab code
<order>
   <id>00000000-0000-0000-0000-000000000000</id>
   <references>
      <reference>
         <referenceType>OurReference</referenceType>
         <value>{OurReference}</value>
      </reference>
      <reference>
         <referenceType>YourReceiverReference</referenceType>
         <value>{YourReceiverReference}</value>
      </reference>
   </references>
   <parties>
      <party>
         <code>{WarehouseCode}</code>
         <partyType>Warehouse</partyType>
      </party>
      <party>
         <code>{CustomerCode}</code>
         <partyType>Customer</partyType>
      </party>
      <party>
         <address1>111</address1>
         <address2>222</address2>
         <code>1234</code>
         <country>New Zealand</country>
         <displayName>Consignee ABCD</displayName>
         <partyType>Receiver</partyType>
         <phone />
         <place>AUCKLAND</place>
         <postCode>1010</postCode>
         <state />
         <suburb>NEWTON</suburb>
      </party>
      <party>
         <address1>111</address1>
         <address2 />
         <code>1723</code>
         <country>New Zealand</country>
         <displayName>Consignee ABCD</displayName>
         <partyType>SoldTo</partyType>
         <phone />
         <place>AUCKLAND</place>
         <postCode />
         <state />
         <suburb>NEWTON</suburb>
      </party>
   </parties>
   <etaDate>2018-06-02</etaDate>
   <orderType>N</orderType>
   <requiredDate>2018-05-31</requiredDate>
   <serviceProvider>
      <displayName>Mainfreight</displayName>
      <serviceLevel>
         <displayName>Metro</displayName>a
      </serviceLevel>
   </serviceProvider>
   <notes>
      <note>
         <noteType>Comment1</noteType>
         <value>Comment1</value>a
      </note>
      <note>
         <noteType>DeliveryInstructions</noteType>
         <value>def</value>
      </note>
   </notes>
   <orderLines>
      <orderLine>
         <attributes>
            <attribute>
               <attributeType>Grade1</attributeType>
               <value>Grade1</value>
            </attribute>
            <attribute>
               <attributeType>ExpiryDate</attributeType>
               <value>2018-05-31</value>
            </attribute>
         </attributes>
         <lineNo>1</lineNo>
         <note>
            <value>Product Line</value>
         </note>
         <product>
            <code>{ProductCode}</code>
            <displayName>{ProductDescription}</displayName>
         </product>
         <units>2</units>
      </orderLine>
   </orderLines>
</order>
NOTE: Content in the panels below this point are not visible on the site unless used by other features e.g. gadgets, OB&E, etc.