You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
You are viewing the article in preview mode. It is not live at the moment.
Purchase Orders API
print icon
Purchase Orders API
 

There are five methods available for purchase orders:

  1. List all purchase orders
  2. Return full detail on a single purchase order
  3. Add a purchase order
  4. Update an existing purchase order
  5. Delete (make inactive) a purchase order depending on status
List all purchase orders

End Point: https://api.myposconnect.com/api/v2/purchaseorders

Verb: GET

Example Call: https://api.myposconnect.com/api/v2/purchaseorders?filt_LastEditDateUTC_dt_min=2022-mar-04%2009%3a00&filt_LastEditDateUTC_dt_max=2022-mar-10%2009%3a00

Return Codes: 200 for success, with the body containing the JSON for the orders. For other possible (more general) return codes please see API Build Basics

Important: This call returns a restricted flat view of the orders. The JSON objects in the array are not full order JSON objects as shown in the appendices of this document. If some of the deeper information is required then you will need to use the method for getting a single order object below. There are several query string arguments that can be used with this call as follows (you may need to URL encode your argument values).

Filters: 

There are several query string arguments that can be used with this call as follows (you may need to URL encode your argument values).

filt_LastEditDate_dt_min

Optional Local Device DateTime String (yyyy-MMM-dd HH:mm) – use to filter results by the “LastEditDateUTC” property. Example value of “2020-oct-06 11:10” would be URL encoded to “2020-oct-06%2011%3a10”.
 

filt_LastEditDate_dt_max

Optional Local Device DateTime String (yyyy-MMM-dd HH:mm) – use to filter results by the “LastEditDateUTC” property.

filt_LastEditDateUTC_dt_min

Optional UTC DateTime String (yyyy-MMM-dd HH:mm) – use to filter results by the “LastEditDateUTC” property. Example value of “2020-oct-06 11:10” would be URL encoded to “2020-oct-06%2011%3a10”.

filt_LastEditDateUTC_dt_max

Optional UTC DateTime String (yyyy-MMM-dd HH:mm) – use to filter results by the “LastEditDateUTC” property.

filt_XXXXXXX_XXX

Other filtering query string arguments may be available if requested, please let us know at [email protected].

Return full detail on a single purchase order

End Point: https://api.myposconnect.com/api/v2/purchaseorders/{identifier}

Verb: GET

Return Codes: 200 for success, with the body containing the JSON for the order. For other possible (more general) return codes please see API Build Basics

Important: This call returns a view of a single order and related fields including custom fields tailored for individual MYPOS clients. 

Example JSON Object
Single Purchase Order

{
       "purchaseOrderId": "259dfba9-f213-43cd-a53c-840f3347c5dc",
       "purchaseOrderNo": "100003",
       "purchaseOrderDate": "2020-10-25T00:00:00",
       "purchaseOrderDueDate": "2020-10-25T00:00:00",
       "purchaseOrderStatus": "R",
       "supplierId": "2c754398-2ea2-40f3-a6dc-c47f5bf8f0d2",
       "deliveryId": "67fcefb2-fcaf-4424-98fa-7768e7025825",
       "purchaseOrderNotes": "This purchase order was imported",
       "supplierName": "ARCHER1B",
       "storeName": "Archer Office",
       "lineItems": [
           {
       "guid": "d9be5985-97c8-4329-8c79-11b341c46458",
       "purchaseOrderItemNo": "1",
       "productId": "33306570-fa71-4827-a12a-77fa33bef73c",
       "productDescription": "archerimport1",
       "stockUnit": "10 PACK",
       "quantity": 100.00000,
       "unitPrice": 100.00000,
       "itemValue": 10000.00000,
       "quantityReceived": 0.00000,
       "quantityDue": 100.00000,
       "quantityCancelled": 0.00000
           },
           {
       "guid": "0b49a30d-7901-4e7e-b875-0bb301941e8f",
       "purchaseOrderItemNo": "2",
       "productId": "40551526-b699-4919-9895-7d5fe37f0dcb",
       "productDescription": "archerimport2",
       "stockUnit": "10 PACK",
       "quantity": 200.00000,
       "unitPrice": 200.00000,
       "itemValue": 40000.00000,
       "quantityReceived": 0.00000,
       "quantityDue": 200.00000,
       "quantityCancelled": 0.00000
           }
           ],
       "lastEditUser": "Rich Archer",
       "creationUser": "Rich Archer",
       "lastEditDevice": "portal",
       "creationDevice": "portal",
       "lastEditDate": "2020-10-25T12:21:15.283",
       "creationDate": "2020-10-25T12:21:15.283"
}

Add a Purchase Order

End Point: https://api.myposconnect.com/api/v2/purchaseorders/{PurchaseOrderNo}

Verb: POST

Return Codes: 202 (Accepted) for success and the body will contain a copy of your JSON object with populated “purchaseorderId” and “purchaseorderNo” fields. 400 (BadRequest) for failure, see the body for more details. For other possible (more general) return codes please see API Build Basics

Important: Post a valid JSON object as shown in the appendices of this document. You can omit a lot of the fields from the JSON if you have no values for them. The “purchaseorderId” field will be automatically generated by the system when adding so do not supply in your JSON for this call as it will be ignored.

 

Update an existing purchase order

End Point: https://api.myposconnect.com/api/v2/purchaseorders/{PurchaseOrderNo}

Verb: PUT

Return Codes: 200 (OK) for success. 400 (BadRequest) for failure, see the body for more details. For other possible (more general) return codes please see API Build Basics

Important: Replace the “{purchaseorderNo}” marker in the given endpoint URL with the code of the purchase order you wish to update – you must also ensure the “puchaseorderId” and “purchaseorderNo” fields are correctly populated for the purchase order you wish to update. To ensure no data is lost please call the GET method to get the purchase order first, make your modifications to it, and then use this PUT method to save the changes back. A future release of the API may introduce the PATCH verb but it is not available currently.

Delete a purchase order

End Point: https://api.myposconnect.com/api/v2/purchaseorders/{PurchaseOrderNo}

Verb: DELETE

Return Codes: 204 (No content) for success. 404 if not found. 409 (Conflict) for failure (the body may indicate that the order has been set to inactive). For other possible (more general) return codes please see API Build Basics

Important: Replace the “{PurchaseOrderNo}” marker in the given endpoint URL with the code of the order you wish to delete. If order has transactions such as receipts you can only make them inactive with this operation.

Troubleshooting Ideas

As with all API connections, you will need to have acquired a bearer token and the user that acquired the token will need to be assigned access permission to this table. If you are not receiving any results send the full endpoint together with any filters and the API user to us from a valid email address and we can advise if permissions have been authorised. You might be able to see data with one table and not another if specific permissions are not applied. Check your filter dates if collecting all rows.

Feedback
0 out of 0 found this helpful

scroll to top icon