Create a Purchase Order with Breakdowns

Use this method to create Purchase Orders with mixed boxes based on Prebooks in units or Standalone Purchase Orders.

Valid Tokens: Company and Vendor.


Please take the following statements into account when you send a request:

  • If your Company has the Multi-Currency option and the Vendor uses a different currency, the system will display the cost in your Company’s currency based on the exchange rate set up when the Purchase Order is created.

  • Every product added using this method must be mapped in your Company. Products that are not mapped (UNKNOWN) will not be added to the Purchase Order.

  • You can use vendorId or vendorCode but you cannot use both parameters at the same time. We recommend you to use the vendorId which can be obtained from the vendor.list API method.

  • If you use a Vendor token, the system will validate that the Prebook Lines processed belong to the authenticated Vendor. 

  • To create Standalone PO, you must send the breakdown product description or the breakdown product code.

  • If you send an invalid Breakdown productCode and Breakdown productDescription, the system will create a vendor product alias with the description sent.

Related Articles

Request


URL: https://api.kometsales.com/api/purchase.order.mixed.create

Method: POST

Content-Type: application/JSON


Input Parameters

authenticationToken (required)(string:50)

Komet Sales security token.


shipDate (required)(date)

Shipping date.

Date format: YYYY-MM-DD


vendorId (required)(integer:20)

Vendor or Grower ID.

You can get this value from the vendor.list API method.

Does not apply to Vendor tokens.


vendorCode (required if vendorId is not given)(string:20)

Vendor or Grower code.

Does not apply to Vendor tokens.


companyLocationCode (required)(string:10)

Location code.

Only applies to Multi-Location Companies.


carrierId (optional)(integer:20)

Inbound Carrier ID.

You can get this value from the carrier.list API method.

This value is required if the company has the setting Mandatory Carriers on the POs.  


carrierCode (optional)(string:20)

Inbound Carrier code.

This value is required if the company has the setting Mandatory Carriers on the POs.


purchaseOrderNumber (optional)(string:10)

Purchase Order number.

Use this parameter if you want to add the items to an existing Purchase Order.


purchaseOrderItems (required)(array)

Array containing items that the system will add to the PO. 


productId (required)(integer:20)

Product Line ID.

You can get this value from the product.list API method. 


productDescription (required if productId is not given)(string:20)

Product description.


productCode (required if productDescription is not given)(string:20)

Product code.


boxTypeCode (required)(string:3)

Box type code.


boxTypeId (required if boxTypeCode is not sent)(integer:10)

Box type ID.

You can get this value from the boxtype.list API method.


boxes (required)(integer:10)

Number of boxes.


unitType (required)(string:5)

Unit type.

Valid values: Stem or Bunch


markCode (optional)(string:30)

Line Mark Code.


AWB Number (optional)(number:4)

Last four digits of the AWB.

When this field is sent, the AWB will have Shipped status.

If the vendor has temporary AWB enabled, the system will automatically assign a temporary AWB.


breakdowns (required)(array)

Array containing product lines that will be added to this PO line. 


prebookItemId (required)(integer:20)

Prebook Line ID. 

Required to associate a Purchase Order to a Prebook.

You can get this value from the prebook.details.list API method.

If this parameter is not included, the system will create a Future Sales Purchase Order (if the feature is enabled).


productId (required)(integer:20)

Product Line ID. 

Required if the prebookItemId, productDescription and productCode are not sent.

You can get this value from the product.list API method. 


productDescription (required if prebookItemId or productId are not sent)(string:20)

Product description.


productCode (required if productDescription is not sent)(integer:20)

Product code.


breakdownProductDescription (optional)(string:30)

The description of the breakdown product.

Required to create a Standalone PO.


breakdownProductCode (optional)(integer:20)

The breakdown product code.

Required to create a Standalone PO.


bunches (required)(integer:10)

Bunches per Box.


stemsBunch (required)(string:10)

Stems per Bunch.


cost (required)(decimal:10,2)

Unit cost.

If you have a Vendor token, the system will only accept this field if your company has the Allow changing cost setting enabled.


Sample Request for Company Tokens

{ "authenticationToken": "token_info_goes_here", "shipDate": "2017-07-14", "carrierCode": "35LS", "vendorCode": "A535", "companyLocationCode": "28", "purchaseOrderNumber": "P02323", "purchaseOrderItems": [ { "productId": "217042", "boxTypeCode": "HB", "boxes": "1", "unitType": "Bunch", "markCode": "MK-308", "breakdowns": [ { "prebookItemId": "928355", "bunches": 10, "stemsBunch": 15, "cost": 1.1 } ] } ] }

Sample Request for Vendor Tokens

{ "authenticationToken": "token_info_goes_here", "shipDate": "2017-07-14", "carrierCode": "35LS", "companyLocationCode": "28", "purchaseOrderItems": [ { "productId": "217042", "boxTypeCode": "HB", "boxes": "1", "unitType": "Bunch", "markCode": "MK-308", "breakdowns": [ { "prebookItemId": "928355", "bunches": 10, "stemsBunch": 15 } ] } ] }

Response


status (integer:1)

Transaction status.

Valid values: 1 = Success | 0 = Failure


items (array)

An array containing items in the Purchase Order.


prebookItemId (integer:10)

Prebook item ID.


status (integer:1)

Transaction status.

Valid values: 1 = Success | 0 = Failure


message (string:500)

Transaction status description.


purchaseOrderId (integer:10)

Purchase Order ID.


purchaseOrderItemId (integer:10)

Purchase Order item ID.


purchaseOrderNumber (string:10) 

Purchase Order Number.  


Sample Response for Company Tokens

{ "status": 1, "items": [ { "prebookItemId": 928342, "status": 1, "message": "The Assorted PO Item was successfully created.", "purchaseOrderId": 87820, "purchaseOrderNumber": "P007098", "purchaseOrderItemId": 282719 } ] }

Sample Response for Vendor Tokens

Peacock