Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
ExcerptThis method allows you

Anchor
topofpage
topofpage

Excerpt

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

Tip

Valid Tokens: Company and Vendor.

Using this method you can create one of the following:

  • Prebook header only.

  • Prebook with header and product(s).

  • Prebook with header and product(s) with breakdown(s).

If you use a Vendor Token:

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

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

Info

Orders Invoices created through this method are subject to a transaction fee of 1.5%.

Code Block
{
   "status": "1",
   "message": "Prebook was successfully created.",
   "prebookId": 2543545,
   "prebookNumber": 4343,
   "purchaseOrderNumbers": "",
   "items": [
      {
         "productId": 999,
         "status": 1,
         "message": "Item successfully added to the order",
         "prebookItemId": 3427612,
         "identifier": "02343678"
      }
   ]
}
Sample Response

. Internal company transactions are generally exempt from this transaction fee.

Filter by label (Content by label)
showLabelsfalse
max5
titleRelated Articles
cqllabel in ( "prebook-api" , "company-token" , "create-prebook" , "recipes" )


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

Customer ID.

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


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

Customer code.


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

Customer name.


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

Carrier ID.

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


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

Carrier code.


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

Carrier name.


shipDate shipDate (required)(date): shipping date (date format

Shipping date.

Date format: YYYY-MM-DD).


createdBy (optional)(integer:20): Id of the user that created the order.

User ID from the User that is creating the Order.

This value represents the owner ID in Komet Sales Owner ID


shipViaId (logical)(integer:1): ship via ID. The ID of the location

Ship Via ID from the Location where the product will be shipped from. Assign 0 for warehouse or 1 for the grower.

Valid values: 0 = Warehouse | 1 = Grower


customerPO (optional)(string:20): customer purchase order

Customer Purchase Order.


isEcommerce (optional)(integer:1): 1 when it is an E-commerce order, 0 when it is a Phone / Regular order. 

Order source.

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


useExisting (optional) (integer:1): 1 to add the

Add items to an existing Prebook with the same locationLocation, carrierCarrier, truck Truck date, customer, Customer and customer PO# and ship to (if applicable). Enter 0 to create a new Prebook. By default will be 0. Customer PO#, if there is one.

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

Default is zero.


comments (optional)(string:200): special

Special instructions or comments.


autoGeneratePOsfromPrebooks (optional)(integer:1): specify 1 if

If you want the system to automatically generate the purchase orders. Default = 0. If this value is 1, the vendor and costs must be specified. The orders created will be left as Approvedcreate 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): specify 1 if you want the system to automatically allocate the prebook that was just created

Automatically allocate the Prebook with products from the inventory. Default = 0. The system will apply the same rules that the Mass Allocations process has. Only products with ages between 0 and 5 days will be taken in account

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 status of the prebook.

The Prebook status.

Only works when the Prebook Status setting is enabledEnabled.


companyLocationCode (required: if the company is Multi-Location)(string:20):

Location code.

Only applies to Multi-Location Companies. 


prebookItems : array of products:(optional)(array)

An array containing products.


identifier (optional)(string:30): use this field if you want to identify your lines and receive the same value in the response

Line ID.


vendorId (optional)(integer:20): vendor

Vendor or grower Grower ID.

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


vendorCode (optional)(string:20): vendor

Vendor or grower Grower code, if vendorId is not given.


vendorName (optional)(string:200): vendor

Vendor or grower Grower name, if vendorId is not given.


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

Product ID.

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


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

Product code of the product.


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

Product description of the product.


orderSource (optional)(string:20): The source of the product.itemType 

Product source.


itemType (optional)(string 3): the item

Item type. Possible

Valid values: BOX or UN (unit). By default will be = Boxes | UN = Unit

Default is BOX.


boxTypeId boxTypeId (required if boxTypeCode is not given and the itemType and itemType is boxBOX)(integer:20): box

Box type ID.

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


boxTypeCode boxTypeCode (required : if boxTypeId is not given and the itemType and itemType is boxBOX)(string:3): code of the box type

Box type code.


boxTypeDescription boxTypeDescription (required : if boxTypeId is not given and the itemType is boxBOX)(string:3): name of the box type

Box type name.


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

Number of boxes.


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

Number of units.


unitType (required)(string:5): stem or bunch are the unique valid values.

Unit type.

Valid values: Stem or Bunch


bunches (required if the itemType if itemType is BOX)(integer:10): number of bunches per box 

Number of Bunches per Box.


stemsBunch (required if the itemType itemType is boxBOX)(integer:10): stems

Stems per bunchBunch.

You can leave this field empty for mixed boxes.


price (optional)(decimal:10,2): weighted

Weighted average unit price. When unitType is bunch you must use the bunch price. When unitType is stem you must use the stem priceUnit price according to the value entered in unitType.


cost (optional)(decimal:10,2): weighted

Weighted average unit Unit cost. When unitType is bunch you must use the bunch cost. When unitType is stem you must use the stem cost. If the token used belongs to a vendor, this field will be accepted if the vendor has the Allow changing cost option

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 for item.


notes (optional)(string:1000): any additional

Additional notes.


futureSalesPoNumber (optional)(string:7): future sales purchase order

Future Sales Purchase Order number where the product belongs from. E.g.: to. For example, P057116.

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


breakdowns (optional)(array):

An array of containing product breakdowns:.


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

Product ID.

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


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

Product code of the product.


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

Product description of the product.


bunches (required)(integer:10): bunches

Bunches per boxBox.


stemsBunch (required)(integer:10): stems for bunch

Stems per Bunch.


cost (required)(decimal:10,2): when unitType is bunch you must use the bunch cost. When unitType is stem you must use the stem cost. If the token used belongs to a vendor, this field will be accepted if the vendor has the Allow changing cost option

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 for tokens type company)(decimal:10,2): when unitType is bunch you must use the bunch price. When unitType is stem you must use the stem price.

info

Unit price, according to the value provided in unitType.

Only applies to Company tokens.


  • You can only use customerId and customerCode, or customerName at a time. We recommend you to use

the
  • customerId which can be obtained from the customer.list API method.

  • You can use

either
  • carrierName

and carrierId
  • and carrierId or

carrierCode at
  • carrierCode at a time. We recommend you to use

the
  • carrierId which can be obtained from the carrier.list API method.

Back to top


Code Block
{
   "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

Transaction status. 1 for success or 0 for failure.

Valid values: 1 = Success | 0 = Failure


message (string:500) : description of the status of the transaction

Transaction status description.


prebookId (integer:20): prebook

Prebook ID.


prebookNumber (integer:10): prebook

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). The value that identifies the line.

Line ID.

This is the same value entered in the identifier parameter of the request, if it was given.


status: (integer:1): transaction

Transaction status. 1 for success or 0 for failure.

Valid values: 1 = Success | 0 = Failure


message (string:500): description of the status of the transaction

Transaction status description.


prebookItemId (integer:10)

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


productId (integer:20) (if productId was given)

Product ID.

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


productCode (string:20) (if productCode was given)

Product code.

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


futureSalesPoNumber (string:7) (if futureSalesPoNumber was given)

Future Sales PO Number.

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


availableBoxes (integer:10): number

Number of boxes that are available.

Only applies if futureSalesPoNumber was given in the request.

Back to top


Code Block
{
   "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"
      }
   ]
}

We've encountered an issue exporting this macro. Please try exporting this page again later.