Index | Conventions

api/v1/pocreate

Path: api/v1/pocreate

This endpoint supports the following methods:
POST

Summary: Creates a new purchase order

Query Parameters

ParameterOptionalDescription
QueueSet to true, 1, or t to queue the request via the Jim2 eBusiness Queue. If specified the response will be 202 Accepted and the B2B request number will be returned.
Leave out, or set to false, 0, or f to process the request immediately.
SubmitRefIdA unique reference ID for the request. This is used to prevent duplicate requests when the Queue parameter is also passed. If a SubmitRefId is passed via this query parameter and within the request content (see submitRefId in JSON content) then the two values must be the same. A check for duplication due to re-processing on the B2B queue is NOT performed unless the SubmitRefId is included in the request body (ie not passing the SubmitRefId in the message body allows an item on the B2B queue to be reprocessed and potentially creating a duplicate object).
The Queue parameter must also be specified if SubmitRefId is specified.
Note that the SubmitRefId must be unique to Jim2, so if multiple systems are making calls care must be taken to avoid clashes in SubmitRefIds between systems.

Request content

AttributeTypeRequiredDescription
allowPartShipbooleanSet to true if the the order can be part shipped
bidReferencestringThe bid reference.
branchstringThe branch code. Branches must be enabled.
buyerobjectThe company doing the purchasing. Only relevant for multi company databases.
See the buyer section below.
buyerOrderNostringOBSOLETE: Use vendorInvNo instead.
calcPricesFromTaxPaidbooleanDefault is according Tools->Options Purchase, Calc Tax Total From.
commentsarray of objectSee the comments section below.
customanyA free-form JSON object carrying additional data for custom processing. Used where custom processing is required and additional data must be passed to that custom processing.
dateDuestringThe date due for the new PO. Must be in ISO date format - eg "2020-01-31"
fromobjectSee the from section below.
glDeptstringThe GL department code. GL departments must be enabled.
notesstringNotes / description on the PO.
ourRefstringOur reference for the PO.
poTypestringThe PO type. If omitted the PO type will be Purchase. Can be set to Purchase or Debtors PO.
sellerobjectThe seller (vendor) card file the purchase order is raised against.
See the seller section below.
shipToobjectSee the shipTo section below.
statusstringThe status for the PO. This status must be valid per workflow from Booked, and cannot be Received or FINISH.
stockLinesarray of objectSee the stockLines section below.
subBranchstringThe sub-branch code. Sub-branches must be enabled. Note that in the UI sub-branches may be renamed.
submitRefIDstringA unique reference for the create request. This reference must be unique for each object and can be used to ensure duplicate objects are not created when re-trying API calls. Note this reference must be unique in Jim2, so if multiple systems are creating objects care must be taken to avoid clashes between the different system's submit ref id. Refer also to the SubmitRefId url query parameter for relevant endpoints.
vendorInvNostringThe vendor invoice # for PO Type Purchase. The customer invoice # for PO Type Debtors PO.

buyer

Attributes of the buyer object.

AttributeTypeRequiredDescription
accountNostringThe buyer's account number. If supplied must be consistent with the sellor cardCode or cardNo if either of those are also supplied. In Jim2 the buyer account number is stored on the vender cardfile. NB for multicompany, if the vendor account number is used a seperate vendor cardfile must be used for each company.
cardCodestringcardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).
cardNointegercardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).

comments

Attributes of each element in the comments array.

AttributeTypeRequiredDescription
commentstringThe comment text.

from

Attributes of the from object.

AttributeTypeRequiredDescription
cardCodestringcardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).
cardNointegercardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).

seller

Attributes of the seller object.

AttributeTypeRequiredDescription
cardCodestringcardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).
cardNointegercardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).

shipTo

Attributes of the shipTo object.

AttributeTypeRequiredDescription
cardCodestringcardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).
cardNointegercardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2).

stockLines

Attributes of each element in the stockLines array.

AttributeTypeRequiredDescription
buyerStockCodestringThe Jim2 stock code (the Jim2 user is buying the stock)
discountnumberDiscount percent.
locationstringThe location to which the stock is to be delivered. Normally this field is left out.
qtynumberThe quantity of the stock to order.
serialsarray of objectOnly applicable to stock that is serial on purchase or serial on sell. An array of serial numbers (and possible attributes if stock is also attributed) related to this stock.
See the stockLines.serials section below.
stockAttrsarray of objectOnly applicable to stock that is attribute on purchase or attribute on sell. An array of attributes related to this stock.
See the stockLines.stockAttrs section below.
unitPriceTFnumberThe price ex. If no price is required then Jim2's default PO pricing will be used. However, only one of PriceTF or PriceTP can be provided.
unitPriceTPnumberThe price inc. If no price is required then Jim2's default PO pricing will be used. However, only one of PriceTF or PriceTP can be provided. Note that if the customer is not paying tax this will be the equalent to specifying the same value in unitPriceTF
unitQtynumberThe number of base units contained in each unit of measure (eg 12 for a box of 12). If omitted, 1 is used.

stockLines.serials

Attributes of each element in the stockLines.serials array.

AttributeTypeRequiredDescription
serialNostringA stock serial number.
stockAttrsarray of objectOnly applicable to stock that is serial and attributed on purchase or serial on sell.
See the stockLines.serials.stockAttrs section below.

stockLines.stockAttrs

Attributes of each element in the stockLines.stockAttrs array.

AttributeTypeRequiredDescription
namestringThe attribute name.
valuestringThe attribute value. Note, this is always send as a string, but the attribute type dictates the acceptable string formats.
eg integer attributes values must be a whole number
date attribute values must be a date is ISO format
real attribute values must be a decimal string (with period as the decimal separator)checkbox values must be a boolan value ("true", or "false").

stockLines.serials.stockAttrs

Attributes of each element in the stockLines.serials.stockAttrs array.

AttributeTypeRequiredDescription
namestringThe attribute name.
valuestringThe attribute value. Note, this is always send as a string, but the attribute type dictates the acceptable string formats.
eg integer attributes values must be a whole number
date attribute values must be a date is ISO format
real attribute values must be a decimal string (with period as the decimal separator)checkbox values must be a boolan value ("true", or "false").

Response content

AttributeTypeDescription
poNointegerThe number of the created PO.

Example POST

Path: /api/v1/pocreate

Request:

{
    "submitRefID": "PO-REQ-0001",
    "objectSource": "Jim2Commerce",
    "poType": "Purchase",
    "vendorInvNo": "VINV-99887",
    "calcPricesFromTaxPaid": false,
    "buyer": {
        "cardNo": 1001,
        "cardCode": "P.COMPANY2",
        "accountNo": "ACC-1001"
    },
    "seller": {
        "cardNo": 2002,
        "cardCode": "VEND.1"
    },
    "shipTo": {
        "cardNo": 1001,
        "cardCode": "P.COMPANY2"
    },
    "from": {
        "cardNo": 2002,
        "cardCode": "VEND.1"
    },
    "dateDue": "2026-07-15",
    "ourRef": "PO-REF-01",
    "status": "Booked",
    "bidReference": "BID-21321231",
    "allowPartShip": true,
    "branch": "SYD",
    "subBranch": "SALE",
    "glDept": "1",
    "notes": "Purchase order notes.",
    "comments": [
        {
            "comment": "Initial PO note."
        }
    ],
    "stockLines": [
        {
            "buyerStockCode": "WIDGET-1",
            "qty": 20,
            "unitPriceTF": 25.00,
            "discount": 5.00,
            "location": "MAIN",
            "serials": [
                {
                    "serialNo": "serial1",
                    "stockAttrs": [
                        { "name": "Colour", "value": "R,Red" }
                    ]
                }
            ]
        },
        {
            "buyerStockCode": "GADGET-2",
            "qty": 10,
            "unitPriceTP": 33.00,
            "stockAttrs": [
                { "name": "Size", "value": "8,Eight" }
            ]
        }
    ],
    "custom": {
        "externalRef": "EXT-12345"
    }
}

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
    "poNo": 12
}