Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Version published after converting to the new editor

Overview


Excerpt

This method allows you to create Purchase Orders with mixed boxes based on purchase needs (Prebooks) in units or Standalone POs (no associated to any Prebook).


Request

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

  • Method: POST
  • Content-Type: application/json

The method requires a JSON format request.

Input JSON 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 obtain this value from vendor.list API method. If the token used belongs to a vendor, this field is optional and it will be ignored. 
  • vendorCode (required: if vendorId is not given)(string:20): vendor or grower code, only required if vendorId is not given. If the token used belongs to a vendor, this field is optional and it will be ignored. 
  • companyLocationCode (required: if the company is Multi Location)(string: 10): Company location code. 
  • carrierId (optional)(integer:20): Carrier ID. The carrier entered must be type Inbound. You can obtain this value from the carrier.list API method. This value could be required if the company turns on a setting that makes this value required on all the screens. 
  • carrierCode (optional)(string:20) : carrier code, if carrierId is not given. The carrier entered must be type Inbound. This value could be required if the company turns on a setting that makes this value required on all the screens.
  • purchaseOrderNumber (optional)(string:10): Purchase order number. You may want to use this field if you want to use an existing PO to add these items. 
  • purchaseOrderItems (required)(array): Array of items that want to associate to the PO. 
    • productId (required)(integer:20)Product Line Id. You can obtain this value from the product.list API method. 
    • productDescription: required if the productId is not entered.
    • productCode: required if the productDescription is entered.
    • boxTypeCode (required)(string:3): code of the box type.
    • boxTypeId (required: if boxTypeCode is not sent)(integer:10): Id of the box type. You can obtain this value from the boxtype.list API method.
    • boxes (required)(integer:10): number of boxes.
    • unitType (required) (string:5): Stem or Bunch are the unique valid values.
    • markCode (optional) (string:30): special mark for the line.
    • AWB Number (optional) (number:4): Last four digits of the AWB. When this field is entered, the AWB will have a Shipped status. If the vendor has temporary AWB enabled, the system will automatically assign an AWB.
    • breakdowns (required)(array): Array of product lines that will be added to this PO line. 
      • prebookItemId (required for PO associated to Prebooks)(integer:20): Prebook Line Id. You can obtain this value from the prebook.details.list API method. If this parameter is not included, the system will create a purchase order for Future Sales (in case this feature is enabled).
      • productId (required)(integer:20): Product Line Id. Required if the prebookItemId, productDescription and productCode are not sent. You can obtain this value from the product.list API method. 
      • productDescription: Required if the prebookItemId, productId are not sent.
      • productCode: required if the productDescription is entered.
      • Breakdown Product Description (To create PO Standalone you must send either the breakdown product description or the breakdown product code). The description of the breakdown product.
      • Breakdown Product Code (optional) (To create PO Standalone you must send either the breakdown product description or the breakdown product code). The code of the breakdown.
      • bunches (required) (integer:10): bunches per box.
      • stemsBunch (required)(string:10): 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 enabled.

Info
titleInformation
  • You can use either vendorId or the 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.
  • Using a vendor token, the system will validate that the Prebook Lines processed really belong to the vendor authenticated. 
  • To create Standalone PO, you must send the breakdown product description or the breakdown product code. In case you send a breakdown product code and the breakdown product description is invalid, the system will create a vendor product alias with the description sent.


Elite soft json viewer
width100%
languagejs
themeConfluence
titleSample 1: Company Token
height450
{ "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 } ] } ] }


Elite soft json viewer
width100%
languagejs
themeConfluence
titleSample 1: Vendor Token
height400
{ "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

Output:

  • status (integer:1): transaction status. 1 for success or 0 for failure. Please notice that every PO item processed will have its own status. 
  • items (array)
    • status: (integer:1): transaction status. 1 for success or 0 for failure.
    • message (string:500): description of the status of the transaction.
    • prebookItemId (integer:10) ID of the prebook item that was added to the purchase order.
    • purchaseOrderId (integer:10) ID of the Purchase Order that was used during this transaction.
    • purchaseOrderItemId (integer:10) ID of the Purchase Order Item that was created during this transaction
    • purchaseOrderNumber (string:10) Purchase Order Number that was used during this transaction. 

Elite soft json viewer
width100%
languagejs
themeConfluence
titleSuccess
{ "status": 1, "items": [ { "prebookItemId": 928342, "status": 1, "message": "The Assorted PO Item was successfully created.", "purchaseOrderId": 87820, "purchaseOrderNumber": "P007098", "purchaseOrderItemId": 282719 } ] }


Elite soft json viewer
width100%
languagejs
themeConfluence
titleFailure
height200
{ "status": 1, "items": [ { "prebookItemId": 928342384, "status": 0, "message": "The Prebook Item does not exist." } ] }



Panel
titleRelated Articles

Filter by label (Content by label)
showLabelsfalse
max10
showSpacefalse
sorttitle
cqllabel = "purchase-orders"
labelspurchase-orders


Info
titleInformation
  • This method can be executed with tokens type company and vendor.
  • If the multicurrency option is enabled, and the vendor of the PO has a different currency set up, the system will display the cost in the company's currency, based on the exchange rate set up when the PO is created.
  • Make sure that all of the products sent through this method have already been mapped in the company. Products marked as UNKNOWN will be skipped