Path: api/v1/pocreate
This endpoint supports the following methods:
POST
Summary: Creates a new purchase order
Query Parameters
| Parameter | Optional | Description |
|---|---|---|
| Queue | ✓ | Set 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. |
| SubmitRefId | ✓ | A 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
| Attribute | Type | Required | Description |
|---|---|---|---|
| allowPartShip | boolean | Set to true if the the order can be part shipped | |
| bidReference | string | The bid reference. | |
| branch | string | The branch code. Branches must be enabled. | |
| buyer | object | The company doing the purchasing. Only relevant for multi company databases. See the buyer section below. |
|
| buyerOrderNo | string | OBSOLETE: Use vendorInvNo instead. | |
| calcPricesFromTaxPaid | boolean | Default is according Tools->Options Purchase, Calc Tax Total From. | |
| comments | array of object | See the comments section below. | |
| custom | any | A 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. | |
| dateDue | string | The date due for the new PO. Must be in ISO date format - eg "2020-01-31" | |
| from | object | See the from section below. | |
| glDept | string | The GL department code. GL departments must be enabled. | |
| notes | string | Notes / description on the PO. | |
| ourRef | string | Our reference for the PO. | |
| poType | string | The PO type. If omitted the PO type will be Purchase. Can be set to Purchase or Debtors PO. | |
| seller | object | ✓ | The seller (vendor) card file the purchase order is raised against. See the seller section below. |
| shipTo | object | See the shipTo section below. | |
| status | string | The status for the PO. This status must be valid per workflow from Booked, and cannot be Received or FINISH. | |
| stockLines | array of object | See the stockLines section below. | |
| subBranch | string | The sub-branch code. Sub-branches must be enabled. Note that in the UI sub-branches may be renamed. | |
| submitRefID | string | A 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. | |
| vendorInvNo | string | The vendor invoice # for PO Type Purchase. The customer invoice # for PO Type Debtors PO. |
Attributes of the buyer object.
| Attribute | Type | Required | Description |
|---|---|---|---|
| accountNo | string | The 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. | |
| cardCode | string | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). | |
| cardNo | integer | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). |
Attributes of each element in the comments array.
| Attribute | Type | Required | Description |
|---|---|---|---|
| comment | string | ✓ | The comment text. |
Attributes of the from object.
| Attribute | Type | Required | Description |
|---|---|---|---|
| cardCode | string | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). | |
| cardNo | integer | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). |
Attributes of the seller object.
| Attribute | Type | Required | Description |
|---|---|---|---|
| cardCode | string | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). | |
| cardNo | integer | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). |
Attributes of the shipTo object.
| Attribute | Type | Required | Description |
|---|---|---|---|
| cardCode | string | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). | |
| cardNo | integer | cardCode or cardNo are required. If both are supplied that must be consistent with each other (ie match what is stored within Jim2). |
Attributes of each element in the stockLines array.
| Attribute | Type | Required | Description |
|---|---|---|---|
| buyerStockCode | string | ✓ | The Jim2 stock code (the Jim2 user is buying the stock) |
| discount | number | Discount percent. | |
| location | string | The location to which the stock is to be delivered. Normally this field is left out. | |
| qty | number | ✓ | The quantity of the stock to order. |
| serials | array of object | Only 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. |
|
| stockAttrs | array of object | Only 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. |
|
| unitPriceTF | number | The 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. | |
| unitPriceTP | number | The 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 | |
| unitQty | number | The number of base units contained in each unit of measure (eg 12 for a box of 12). If omitted, 1 is used. |
Attributes of each element in the stockLines.serials array.
| Attribute | Type | Required | Description |
|---|---|---|---|
| serialNo | string | ✓ | A stock serial number. |
| stockAttrs | array of object | Only applicable to stock that is serial and attributed on purchase or serial on sell. See the stockLines.serials.stockAttrs section below. |
Attributes of each element in the stockLines.stockAttrs array.
| Attribute | Type | Required | Description |
|---|---|---|---|
| name | string | ✓ | The attribute name. |
| value | string | ✓ | The 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"). |
Attributes of each element in the stockLines.serials.stockAttrs array.
| Attribute | Type | Required | Description |
|---|---|---|---|
| name | string | ✓ | The attribute name. |
| value | string | ✓ | The 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
| Attribute | Type | Description |
|---|---|---|
| poNo | integer | The number of the created PO. |
Path: /api/v1/pocreate Request: 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.
Example POST
{
"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"
}
}
{
"poNo": 12
}