Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This method allows you add a prebook to the system. You can set up your request to create a:

  1. Prebook header only.
  2. Prebook with header and product(s).
  3. Prebook with header and product(s) with 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 is not given) (integer:20) : Carrier Id. You can obtain this value from thecarrier.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).
  • shipViaId (logical)(integer:1): 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)(string:200): Special instructions or comments.
  • autoGeneratePOsfromPrebooks (optional)(integer:1): Specify "1" if you want the system to automatically generates the purchase orders. Default = 0. If this value is 1, the vendor and costs must be specified.
  • prebookItems: Array of products:
    • 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 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:200): Any additional notes.
    • 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.
      • 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.

Sample 1: Based on IDs

Sample 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
         }
       ]
    }
 ]
 }
Sample 2: Based on codes
 {
  "authenticationToken": "token_info_goes_here",
  "customerCode": "ANG",    
  "customerDescription": "Ang Flowers",
  "customerPO": "2926",
  "carrierCode": "AR",
  "carrierDescription":"Armellini",
  "shipDate": "2014-09-11",
  "comments": "Comments or special instructions",
  "autoGeneratePOsfromPrebooks":"1",
  "prebookItems": 
  [
    {
      "vendorCode": "ABC",
      "vendorDescription": "Flores ABC",
      "productCode": "Rs55B",
      "productDescription":"Roses 55cm Blue",
      "boxTypeCode": "HB",
      "boxTypeDescription":"HB",
      "unitType": "Stem",
      "boxes": 5, 
      "bunches": 10, 
      "stemsBunch": 2,
      "cost": 0.70,
      "price": 2.50,
      "markCode": "text for mark code", 
      "notes": "text for notes"
    } 
  ]
}

 

Response

 

Output:

 

  • status (integer:1): Transaction status. 1 for success or 0 for failure.
  • message (string:500): Description of the status of the transaction.
  • prebookId (integer:20): Prebook ID.
  • prebookNumber (integer:10): Prebook number.
  • purchaseOrderNumbers (string:200) PO Numbers separated by commas, if autoGeneratePOsfromPrebooks is given.


Sample 1
 {
  "status": "1",
  "message": "Prebook was successfully created.",
  "prebookId": 2543545,
  "prebookNumber": 4343,
  "purchaseOrderNumbers": ""
 }
Sample 2
 {
  "status": 1,
  "message": "Prebook was successfully created. All the purchase orders were successfully created",
  "prebookId": 1640006,
  "prebookNumber": "010225",
  "purchaseOrderNumbers": "P002989, P002990"
 }

 

 

 

  • No labels