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.
Products API
print icon
Products API
 

There are five methods available for products :

  1. List all products
  2. Return full detail on a single product
  3. Add a new product
  4. Update an existing product
  5. Delete a product

Your login might have permission for one, some or all methods, for example you might be able to list and update but not add or delete products.

List all products

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

Verb: GET

Example Call: https://api.myposconnect.com/api/v2/products?liPage=1&liPageSize=99999&sSortKey=LastEditDateUTCDESC&filt_LastEditDateUTC_dt_min=2020-oct-01%2009%3a00&filt_LastEditDateUTC_dt_max=2022-dec-31%2009%3a00

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

Important: This call returns a restricted flat view of the Products. The JSON objects in the array are not full Products 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 product object. 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: 

liPage

Optional Integer - defaults to 1 if not supplied

liPageSize

Optional Integer - defaults to 10 if not supplied

sSortKey

Optional String – acceptable values are the name of any returned field appended with ASC or DESC (eg “shortDescriptionDESC” means sort the results by the short description field in descending order)

sFieldList

Optional String – use to limit which fields are returned. Acceptable value is the comma-separated names of any returned field (eg “productid,productCode,longDescription”). It is a good idea to use this argument if you do not require all the fields in the returned JSON. Please note you will always receive the fields “customSortRowNumber” and “liTotalCount” which allow you to establish how many pages of results there are and where each row lies within the results.

filt_LastEditDateUTC_dt_min

Optional 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 DateTime String (yyyy-MMM-dd HH:mm) – use to filter results by the “LastEditDateUTC” property.

filt_LongDescription_str

Optional String  - use to filter results by the “LongDescription” property (part match, eg “123” matches “xxx123xxx”).

filt_XXXXXXX_XXX

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

Return full detail on a single product by Product Code productCode

End Point: https://api.myposconnect.com/api/v2/products/{productcode}

Verb: GET

Example Call: https://api.myposconnect.com/api/v2/products/123456

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

Important: This call returns a view of a single product and related fields including additional classes, menus, recipes and bills of material and dynamic Custom Fields tailored for individual MYPOS clients. 

Add a new product

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

Verb: POST

Example Call: https://api.myposconnect.com/api/v2/products/{productCode}

Return Codes: 202 (Accepted) for success and the body will contain a copy of your JSON object with populated “productId” and “productCode” 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 below in this document. You can omit a lot of the fields from the JSON if you have no values for them. The “productId” field will be automatically generated by the system when adding so do not supply in your JSON for this call or it will be ignored. The “productCode” field will be generated for you if you do not supply it.

Update existing product

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

Verb: PUT

Example Call: https://api.myposconnect.com/api/v2/products/{productCode}

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 “{productCode}” marker in the given endpoint URL with the code of the product you wish to update – you must also ensure the “productId” and “productCode” fields are correctly populated for the product you wish to update. To ensure no data is lost please call the GET method to get the product first, make your modifications to it, and then use this method to save the changes back. A future release of the API may introduce the PATCH verb but it is not available currently.

Delete product

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

Verb: DELETE

Example Call: https://api.myposconnect.com/api/v2/products/{productCode}

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

Important: Replace the “{productCode}” marker in the given endpoint URL with the code of the product you wish to delete. NOTE a product might set as inactive rather than delete. It can only delete if there is no related transactions including sales and stock adjustments, or core data including menus and recipes.

Example JSON Object
Single Product


       "customSortRowNumber": 1, 
       "liTotalCount": 330, 
       "productId": "dbdf6880-9fb9-4783-8233-6908c0b40ccc", 
       "productCode": "123456-01", 
       "shortDescription": "A simple description", 
       "longDescription": "A description for reports", 
       "fullDescription": "A fuller description for reports and web pages", 
       "barcode": "5555155049518", 
       "productClasses": "", 
       "productReportingClass": "Accessories", 
       "productType": "S", 
       "modifierType": null, 
       "buttonText": " A simple description", 
       "buttonBackColour": null, 
       "buttonForeColour": null, 
       "buttonImage": null, 
       "buttonFontSize": null, 
       "stockControl": "Y", 
       "taxCode": "c50288ec-a18d-43da-9cde-2625e6069233", 
       "price01": 30.0000, 
       "price02": 0.0000, 
       "price03": 0.0000, 
       "price04": 0.0000, 
       "price05": 0.0000, 
       "price06": 0.0000, 
       "price07": 0.0000, 
       "price08": 0.0000, 
       "price09": 0.0000, 
       "price10": 30.0000, 
       "cost": 0.0000, 
       "lastCost": 0.0000, 
       "marginTarget": 0.00000, 
       "marginActual": 0.00000, 
       "recommendedPrice": null, 
       "onhand": 0.00000, 
       "reorderPoint": 0.00000, 
       "productImage": null, 
       "productNotes": "No Serial Number Required", 
       "active": true, 
       "productRestriction": "None", 
       "brand": "", 
       "productSize": null, 
       "productColour": "", 
       "styleCode": "", 
       "unitofMeasureSales": "aeda6744-d13d-4ff9-baac-602581a2303a", 
       "unitofMeasureStock": "aeda6744-d13d-4ff9-baac-602581a2303a", 
       "rewardPoints": null, 
       "printer1": false, 
       "printer2": false, 
       "printer3": false, 
       "printer4": false, 
       "printer5": false, 
       "printer6": false, 
       "printer7": false, 
       "printer8": false, 
       "printer9": false, 
       "webOrders": false, 
       "cC_001": null, 
       "cC_002": null, 
       "cC_003": null, 
       "cC_004": null, 
       "cC_005": null, 
       "cC_006": null, 
       "cC_007": null, 
       "cC_008": null, 
       "cC_009": null, 
       "cC_010": null, 
       "lastEditUser": "J Bond", 
       "creationUser": "J Bond", 
       "lastEditDevice": "Web portal", 
       "creationDevice": "Web portal", 
       "lastEditDate": "2021-08-11T02:00:08.58", 
       "creationDate": "2021-03-01T08:23:02.423", 
       "creationDateUTC": "2021-03-01T08:23:02.423", 
       "lastEditDateUTC": "2021-08-11T01:00:08.58", 
       "forceModifiers": null, 
       "targetFunction": null, 
       "activeDate": null, 
       "salesMaximumQty": null, 
       "orderMaximumQty": null, 
       "stockABCClassification": null, 
       "promotionGroup": null, 
       "priceType": null, 
       "binLocation": "", 
       "commissionType": null, 
       "commissionValue": null, 
       "printSort": null, 
       "customerDiscount": true, 
       "customerDiscountOverride": null, 
       "productWeight": null, 
       "productCondition": null, 
       "allowDiscounts": true, 
       "allowPriceOverrides": true, 
       "allowPurchaseOrders": true, 
       "salesBlockStartDate": null, 
       "salesBlockEndDate": null, 
       "barcodeAlternate": null, 
       "mainImageId": null, 
       "lastEditUserName": "J Bond", 
       "lastEditDeviceName": "Web Portal", 
       "creationUserName": "J Bond", 
       "creationDeviceName": "Web Portal", 
       "alternateBarcode1": "", 
       "alternateBarcode2": "", 
       "alternateBarcode3": "", 
       "uomCodeStock": "EACH", 
       "supplierCost": null 
}

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. Watch date filters if used as they can be a common cause of invalid returns.

Feedback
0 out of 0 found this helpful

scroll to top icon