Create a Prebook

Use this method to add a Prebook Order to Komet Sales. You can add a header, header and products, or a header with products and breakdowns.

Valid Tokens: Company and Vendor.

If you use a Vendor Token:

  • The system will omit the price, vendorId, vendorCode, and vendorName parameters.

  • The system will only apply the value entered in price if your company has the Allow Changing Sales Price setting enabled.

Invoices created through this method are subject to a transaction fee. Internal company transactions are generally exempt from this transaction fee.

Related Articles



Request


URL: https://api.kometsales.com/api/prebook.create

Method: POST

Content-Type: application/JSON


Input Parameters

authenticationToken (required)(string:50)

Komet Sales security token.


customerId (required if customerCode is not given)(integer:20)

Customer ID.

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


customerCode (required if customerId is not given)(string:20)

Customer code.


customerDescription (required if customerId is not given)(string:200)

Customer name.


carrierId (required if carrierCode is not given) (integer:20)

Carrier ID.

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


carrierCode (required if carrierId is not given)(string:20)

Carrier code.


carrierDescription (required if carrierId is not given)(string:200)

Carrier name.


shipDate (required)(date)

Shipping date.

Date format: YYYY-MM-DD


createdBy (optional)(integer:20)

User ID from the User that is creating the Order.

This value represents the Komet Sales Owner ID. 


shipViaId (logical)(integer:1)

Ship Via ID from the Location where the product will be shipped from.

Valid values: 0 = Warehouse | 1 = Grower


customerPO (optional)(string:20)

Customer Purchase Order.


isEcommerce (optional)(integer:1)

Order source.

Valid values: 0 = Phone/Regular Order | 1 = E-Commerce


useExisting (optional)(integer:1)

Add items to an existing Prebook with the same Location, Carrier, Truck date, Customer and Customer PO#, if there is one.

Valid values: 1 = Yes | 0 = Create a new Prebook

Default is zero.


comments (optional)(string:200)

Special instructions or comments.


autoGeneratePOsfromPrebooks (optional)(integer:1)

If you want the system to create the Purchase Orders for the Prebook.

To generate the Purchase Orders, you must use the vendorId, vendorName, or vendorCode and cost parameters in the request.

Automatically generated Purchase Orders will have Approved status.

Valid values: 1 = Yes | 0 = No

Default is zero.


autoAllocate (optional)(integer:1)

Automatically allocate the Prebook with products from the inventory.

Valid values: 1 = Yes | 0 = Follow the rules of the Mass Allocations process

The system will only consider products with an Aging between zero and five days.


status (optional)(varchar:50)

The Prebook status.

Only works when the Prebook Status setting is Enabled.


companyLocationCode (required)(string:20)

Location code.

Only applies to Multi-Location Companies. 


prebookItems (optional)(array)

An array containing products.


identifier (optional)(string:30)

Line ID.


vendorId (optional)(integer:20)

Vendor or Grower ID.

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


vendorCode (optional)(string:20)

Vendor or Grower code, if vendorId is not given.


vendorName (optional)(string:200)

Vendor or Grower name, if vendorId is not given.


productId (required if productCode is not given)(integer:20)

Product ID.

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


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

Product code.


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

Product description.


orderSource (optional)(string:20)

Product source.


itemType (optional)(string 3)

Item type.

Valid values: BOX = Boxes | UN = Unit

Default is BOX.


boxTypeId (required if boxTypeCode is not given and itemType is BOX)(integer:20)

Box type ID.

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


boxTypeCode (required if boxTypeId is not given and itemType is BOX)(string:3)

Box type code.


boxTypeDescription (required if boxTypeId is not given and itemType is BOX)(string:3)

Box type name.


boxes (required if itemType is BOX)(integer:10)

Number of boxes.


totalUnits (required if itemType is UN)(integer:10)

Number of units.


unitType (required)(string:5)

Unit type.

Valid values: Stem or Bunch


bunches (required if itemType is BOX)(integer:10) 

Number of Bunches per Box.


stemsBunch (required if itemType is BOX)(integer:10)

Stems per Bunch.

You can leave this field empty for mixed boxes.


price (optional)(decimal:10,2)

Weighted average Unit price according to the value entered in unitType.


cost (optional)(decimal:10,2)

Weighted average Unit cost.

If you use a Vendor token, the system will only accept this parameter if the Allow Changing Cost setting is enabled.


markCode (optional)(string:50)

Item mark code.


notes (optional)(string:1000)

Additional notes.


futureSalesPoNumber (optional)(string:7)

Future Sales Purchase Order number where the product belongs to. For example, P057116.

Please take in account that the PO# must be the exact same number that the system has, this means the order 57116 is not the same order that P057116.


breakdowns (optional)(array)

An array containing product breakdowns.


productId (required if productCode is not given)(integer:20)

Product ID.

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


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

Product code.


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

Product description.


bunches (required)(integer:10)

Bunches per Box.


stemsBunch (required)(integer:10)

Stems per Bunch.


cost (required)(decimal:10,2)

Unit cost, according to the value provided in unitType.

If you use a Vendor token, the system will only accept this parameter if the Allow Changing Cost setting is enabled.


price (required)(decimal:10,2)

Unit price, according to the value provided in unitType.

Only applies to Company tokens.


Back to top


{ "authenticationToken": "token_info_goes_here", "customerId": 9999, "customerPO": "PO4534", "shipToId": 999, "carrierId": 1878, "shipDate": "2014-04-10", "comments": "Comments or special instructions", "prebookItems": [ { "vendorId": 999, "productId": 999, "boxTypeId": 900, "orderSource": "phone call", "unitType": "Stem", "boxes": 5, "bunches": 10, "stemsBunch": 2, "cost": 0.7, "price": 2.5, "markCode": "text for mark code", "notes": "text for notes", "breakdowns": [ { "productId": 999, "bunches": 2, "stemsBunch": 3, "cost": 0.75, "price": 1.5, "identifier": "02343678" } ] } ] }

Response


status (integer:1)

Transaction status.

Valid values: 1 = Success | 0 = Failure


message (string:500)

Transaction status description.


prebookId (integer:20)

Prebook ID.


prebookNumber (integer:10)

Prebook number.


purchaseOrderNumbers (string:200)

PO numbers separated by commas, if autoGeneratePOsfromPrebooks is given.


items (array)

An array containing items in the Prebook.


identifier (string:20)

Line ID.

This is the same value entered in the identifier parameter of the request.


status: (integer:1)

Transaction status.

Valid values: 1 = Success | 0 = Failure


message (string:500)

Transaction status description.


prebookItemId (integer:10)

ID of the product line that was added to the order.


productId (integer:20)

Product ID.

This is the same value entered in the productId parameter of the request.


productCode (string:20)

Product code.

This is the same value entered in the productCode parameter of the request.


futureSalesPoNumber (string:7)

Future Sales PO Number.

This is the same value entered in the futureSalesPoNumber parameter of the request.


availableBoxes (integer:10)

Number of boxes that are available.

Only applies if futureSalesPoNumber was given in the request.

Back to top


{ "status": 1, "message": "Prebook was successfully created. All the purchase orders were successfully created", "prebookId": 1640006, "prebookNumber": "010225", "purchaseOrderNumbers": "P002989, P002990", "items": [ { "productId": 999, "status": 1, "prebookItemId": 3427612, "message": "Item successfully added to the order" }, { "productCode": "RF567", "status": 1, "prebookItemId": 3427612, "futureSalesPoNumber": "P012345", "availableBoxes": 2, "message": "Item successfully added to the order" } ] }

 

Peacock