Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

This method allows you to add a

prebook to the system.

You can set up your request to create aPrebook order to Komet Sales. 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 a breakdown(s).

Request

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

The method requires a JSON format request.

Input JSON Parameters:

  • authenticationToken (required) (string:50): Komet Sales security token.
  • customerId (required: if customerCode is not given) (integer:20): Customer Id. You can obtain this value from thecustomer.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
    Info

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

    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):

      Carrier Id

      customer ID. You can obtain this value from the

      carrier

       customer.list

       API

       API method.

    • carrierCode

      customerCode (required: if

      carrierId

      customerId is not given) (string:20):

      Carrier Code

      customer code.

    • carrierDescription

      customerDescription (required: if

      carrierId

      customerId is not given) (string

      :200) : Carrier Name.
    • shipDate (required) (date): Shipping date (date format YYYY-MM-DD).
    • shipViaId (logical

      :200): customer name.

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

      1

      20) :

      Ship Via id. Id of location where the product will be shipped from. Assign 0 for warehouse or 1 for grower.
    • customerPO (optional)(string:20): Customer Purchase Order.
    • comments (optional

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

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

      200

      20) :

      Special instructions or comments

      carrier code.

    • autoGeneratePOsfromPrebooks (optional

      carrierDescription (required: if carrierId is not given) (

      integer

      string:

      1): Specify 1 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 Approved.
    • autoAllocate (optional)(integer:1): Specify 1 if you want the system to automatically allocate the prebook that was just created with products from the inventory. Default = 0. The system will apply the same rules that the Mass Allocations process has. Only products with age between 0 and 5 days will be taken in account.
    • prebookItems: Array of products:
    • identifier (optional)(string:30): Use this field if you want to identify your lines and receive the same value in the response.
    • vendorId (optional)(integer:20): Vendor or grower ID. You can obtain this value from vendor.list API method.
    • vendorCode

      200) : carrier name.

    • shipDate (required) (date): shipping date (date format YYYY-MM-DD).

    • createdBy (optional) (integer:20): Id of the user that created the order. This value represents the owner ID in Komet Sales. 

    • shipViaId (logical)(integer:1): ship via ID. The ID of the location where the product will be shipped from. Assign 0 for warehouse or 1 for the grower.

    • customerPO (optional)(string:20):

      Vendor or grower code, if vendorId is not given

      customer purchase order.

      vendorName
    • isEcommerce (optional)(

      string

      integer:

      200

      1):

      Vendor or grower name, if vendorId is not given.
    • productId (required: if productCode is not given)(integer:20): Product ID. You can obtain this value from theproduct.list API method.
    • productCode (required: if productId is not given)(string:20): Code of the product.
    • productDescription (required: if productId is not given)(string:200): Description of the product.
    • boxTypeId (required: if boxTypeCode is not given)(integer:20): Box type ID. You can obtain this value from the boxtype.list API method.
    • boxTypeCode (required: if boxTypeId is not given)(string:3): Code of the Box type.
    • boxTypeDescription (required: if boxTypeId is not given)(string:3): Name of the Box type.
    • boxes (required)(integer:10): Number of boxes.
    • unitType (required) (string:5): Stem or Bunch are the unique valid values.
    • bunches (required) (integer:10): Bunches per box.
    • stemsBunch (required) (integer:10): Stems for 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.
    • price (required) (decimal:10,2): When unitType is Bunch you must use the bunch price. When unitType is stem you must use the stem price.
    • markCode (optional)(string:50): Mark code for item.
    • notes (optional)(string:7): Any additional notes.
    • futureSalesPoNumber (optional)(string:7): Future Sales Purchase Order number where the product belongs from. e.g.: P057116. Please take in account that the PO # should be the exactly same number that the system has, this means the order 57116 is not the same order that P057116.
    • breakdowns (optional): Array of product breakdowns:productId (required: if productCode is not given) (integer:20): Product

      1 when it is an E-commerce order, 0 when it is a Phone / Regular order. 

    • useExisting (optional) (integer:1): 1 to add the items to an existing Prebook with the same location, carrier, truck date, customer, and customer PO# and ship to (if applicable). Enter 0 to create a new Prebook. By default will be 0. 

    • comments (optional)(string:200): special instructions or comments.

    • autoGeneratePOsfromPrebooks (optional)(integer:1): specify 1 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 Approved.

    • autoAllocate (optional)(integer:1): specify 1 if you want the system to automatically allocate the prebook that was just created 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.

    • status (optional) (varchar:50): the status of the prebook. Only works when the Prebook Status setting is enabled.

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

    • prebookItems: array of products:

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

      • vendorId (optional)(integer:20): vendor or grower ID. You can obtain 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 obtain this value from the product.list API method.

      • productCode (required: if productId is not given)(string:20): code of the product.

      • productDescription (required: if productId is not given)(string:200): description of the product.

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

      • itemType (string 3): the item type. Possible values: BOX or UN (unit). By default will be BOX.

      • boxTypeId (required if boxTypeCode is not given and the itemType is box)(integer:20): box type ID. You can obtain this value from the 

        product

        boxtype.list API method

        .
      • productCode (required: if productId is not given)(string:20): Code of the product.
      • productDescription (required: if productId is not given)(string:200): Description of the product.
      • bunches (required) (integer:10): Bunches per box.
      • stemsBunch (required) (integer:10): Stems for 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.
      • price (required)(decimal:10,2): When unitType is Bunch you must use the bunch price. When unitType is stem you must use the stem price.

    You can use either customerId or the customerCode and customerName but you cannot use both parameters at the same time. We recommend to use the customerId which can be obtained from the customer.list API method.

    You can use either carrierId or carrierCode and carrierName but you cannot use both parameters at the same time. We recommend to use the carrierId which can be obtained from the carrier.list API method.

    Code Block
    themeConfluence
    languagejs
    titleSample 1: Based on IDs
    {
      "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,
          "unitType": "Stem",
          "boxes": 5, 
          "bunches": 10, 
          "stemsBunch": 2,
          "cost": 0.70,
          "price": 2.50,
          "markCode": "text for mark code", 
          "notes": "text for notes",
          "breakdowns": 
            [
             { 
               "productId": 999,
                "bunches": 2,
                "stemsBunch": 3,
                "cost" : 0.75, 
                "price": 1.50,
                "identifier": "02343678"
             }
           ]
        }
     ]
     }
    Code Block
    themeConfluence
    languagejs
    titleSample 2: Based on codes
    {
      • .

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

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

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

      • totalUnits  (required if the itemType is UN) (integer:10): number of units.

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

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

      • stemsBunch (required if the 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. When unitType is bunch you must use the bunch price. When unitType is stem you must use the stem price.

      • cost (optional) (decimal:10,2): weighted average 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 enabled.

      • markCode (optional)(string:50): mark code for item.

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

      • futureSalesPoNumber (optional)(string:7): future sales purchase order number where the product belongs from. E.g.: P057116. Please take in account that the PO # should be the exactly same number that the system has, this means the order 57116 is not the same order that P057116.

      • breakdowns (optional): array of product breakdowns:

        • productId (required: if productCode is not given) (integer:20): product ID. You can obtain this value from the product.list API method.

        • productCode (required: if productId is not given)(string:20): code of the product.

        • productDescription (required: if productId is not given)(string:200): description of the product.

        • bunches (required) (integer:10): bunches per box.

        • stemsBunch (required) (integer:10): stems for 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 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
    • 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 or carrierCode at a time. We recommend you to use the carrierId which can be obtained from the carrier.list API method.

    Sample Request

    Code Block
    {
       "authenticationToken": "token_info_goes_here",
       "customerCodecustomerId": "ANG",   9999,
       "customerDescriptioncustomerPO": "Ang FlowersPO4534",
       "customerPOshipToId": "2926"999,
       "carrierCodecarrierId": "AR"1878,
      "carrierDescription":"Armellini",   "shipDate": "2014-09-11",
      "comments": "Comments or special instructions",
      "autoGeneratePOsfromPrebooks":"1",04-10",
       "prebookItemscomments": "Comments or  [
        {
      special instructions",
       "vendorCodeprebookItems": "ABC",[
          {
    "vendorDescription": "Flores ABC",       "productCodevendorId": "Rs55B",999,
             "productDescriptionproductId":"Roses 55cm Blue", 999,
             "boxTypeCodeboxTypeId": "HB"900,
             "boxTypeDescriptionorderSource": "HBphone call",
             "unitType": "Stem",
             "boxes": 5,
             "bunches": 10,
             "stemsBunch": 2,
             "cost": 0.707,
             "price": 2.505,
             "markCode": "text for mark code",
             "notes": "text for notes",
             "breakdowns": [
    },     {       "futureSalesPoNumber": "P012345",{
           "vendorCode": "",       "vendorDescriptionproductId": ""999,
          "productCode": "RF567",         "productDescriptionbunches":"Roses Red2,
    Freedom",       "boxTypeCode": "HB",       "boxTypeDescriptionstemsBunch":"HB" 3,
           "unitType": "Stem",       "boxescost": 50.75,
           "bunches": 10,        "stemsBunchprice": 21.5,
           "cost": 0.70,       "priceidentifier": 2.50,"02343678"
             "markCode": "text for mark}
    code",        "notes": "text for notes" ]
          }
       ]
    }

    Response

    Output

    :

    { "status": "1", "message": "Prebook was successfully created.", "prebookId": 2543545, "prebookNumber": 4343, "purchaseOrderNumbers": "", "items": [ {
    • status (integer:1):

      Transaction

      transaction status. 1 for success or 0 for failure.

    • message (string:500):

      Description

      description of the status of the transaction.

    • prebookId (integer:20):

      Prebook

      prebook ID.

    • prebookNumber (integer:10):

      Prebook

      prebook number.

    • purchaseOrderNumbers (string:200) PO

      Numbers

      numbers separated by commas, if autoGeneratePOsfromPrebooks is given.

    • items (array)

      • identifier (string:20). The value that identifies the line. This is the same value of the request, if it

        it

        was given.

      • status: (integer:1):

        Transaction

        transaction status. 1 for success or 0 for failure.

      • message (string:500):

        Description

        description of the status of the transaction.

      • prebookItemId (integer:10)

        Id

        ID of the product line that was added to the

        order.
      • productId (integer:20)(if productId was given)
      • productCode (string:20)(if productCode was given)
      • futureSalesPoNumber (string:7)(if futureSalesPoNumber was given)
      • availableBoxes (integer:10): Number of boxes that are available if futureSalesPoNumber was given.
    Code Block
    themeConfluence
    languagejs
    titleSample 1
      • order.

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

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

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

      • availableBoxes (integer:10): number of boxes that are available if futureSalesPoNumber was given.

    Sample Response

    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"
          "productId": 999,}
       ]
    }

    Sample Response

    Code Block
    {
        "status": 1,
       
        "message": "ItemPrebook was successfully addedcreated. toAll the order purchase orders were successfully created",
       "prebookId": 1640006,
       "prebookItemIdprebookNumber": 3427612"010225",
       "purchaseOrderNumbers": "P002989, P002990",
       "identifieritems": "02343678"[
        }  {
     ]     }
    Code Block
    themeConfluence
    languagejs
    titleSample 2
    {   "statusproductId": 1,999,
             "messagestatus": "Prebook was successfully created. All the purchase orders were successfully created",1,
             "prebookIdprebookItemId": 16400063427612,
        "prebookNumber": "010225",     "purchaseOrderNumbersmessage": "P002989, P002990",
      "items": [Item successfully added to the order"
         { },
           "productId": 999,{
             "statusproductCode": 1"RF567",
             "prebookItemIdstatus": 34276121,
             "messageprebookItemId": "Item successfully added to the order"3427612,
          },   "futureSalesPoNumber": "P012345",
    {         "productCodeavailableBoxes": "RF567"2,
             "statusmessage": 1, "Item successfully added to the order"
          }
       "prebookItemId": 3427612,
            "futureSalesPoNumber":"P012345",
            "availableBoxes": 2,
            "message": "Item successfully added to the order"
        }
       ] 
     }
     
    ]
    }
    Tip

    Valid Tokens: Company and Vendor.

    • If you use a Vendor Token, the price, vendorId, vendorCode, and vendorName parameters will be omitted.

    • If the vendor that uses this method has the settings "Allow changing sales price", the system will consider the price sent.


    Panel
    titleRelated Articles
    Filter by label (Content by label)
    showLabelsfalse
    max10
    showSpacefalse
    sorttitle
    cqllabel in ( "prebooks-creation" , "add-prebooks" )
    labelsprebooks-creation add-prebooks