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

There are five methods available for customers :

  1. List all customers
  2. Return full detail on a single customer by CustomerId or CustomerCode
  3. Add a customer
  4. Update an existing customer
  5. Delete (make inactive) a customer
List all customers

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

Verb: GET

Example Call: https://api.myposconnect.com/api/v2/customers?liPage=1&liPageSize=100&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 Customers. For other possible (more general) return codes please see API Build Basics

Important: This call returns a restricted flat view of the Customers. The JSON objects in the array are not full Customers 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 customer 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 “customerNameASC” means sort the results by the name field in ascending order)

sFieldList

Optional String – use to limit which fields are returned. Acceptable value is the comma-separated names of any returnable field (eg “customerId,customerCode,customerName”). 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_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 customer by Customer Identifier or by Customer Code

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

End Point: https://api.myposconnect.com/api/v2/customers/{customercode}

Verb: GET

Example Call: https://api.myposconnect.com/api/v2/customers/ef1b97c9-4c4e-4f76-9bf5-ce909e7539c0

Example Call: https://api.myposconnect.com/api/v2/customers/0001234

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

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

Example JSON Object
Single Customer

{
       "customerId": "6d2f9635-ce6e-4797-905e-44fc85a4c3a7",
       "customerCode": "200023",
       "customerName": "Clientname Corporation",
       "address": "555 Main Street",
       "city": "New York",
       "region": "NY",
       "postalCode": "10118",
       "country": "USA",
       "phoneNumber": "555 123 7890",
       "faxNumber": "555 123 7891",
       "emailAddress": "[email protected]",
       "webSite": "esbnyc.com",
       "creditLimit": 5.00000,
       "notes": null,
       "active": true,
       "customerType": null,
       "rewardsCollector": false,
       "rewardsNumber": "200010",
       "rewardsValue": null,
       "firstSaledate": null,
       "lastSaledate": null,
       "allowMailing": false,
       "allowDataShare": false,
       "firstName": "Bob",
       "lastName": "Smith",
       "bankSortCode": null,
       "bankAccount": null,
       "bankAccountName": null,
       "correspondenceEmail": false,
       "correspondencePaper": false,
       "discountPercent": null,
       "specificPrices": [
               {
       "id": "1000002",
       "name": "product2",
       "price": 4.56000
               },
               {
       "id": "1000001",
       "name": "product1",
       "price": 1.23000
               },
           ],
       "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": "User Name",
       "creationUser": "User Name",
       "lastEditDevice": "TILL1",
       "creationDevice": "TILL1",
       "lastEditDate": "2021-10-09T10:54:20.493",
       "creationDate": "2021-10-08T16:06:44.643"
}

Add a Customer

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

Verb: POST

Return Codes: 202 (Accepted) for success and the body will contain a copy of your JSON object with populated “customerId” and “customerCode” 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 “customerId” and “customerCode” fields will be automatically generated by the system when adding so do not supply in your JSON for this call as they will be ignored.

Update an existing Customer

End Point: https://api.myposconnect.com/api/v2/customers/{customerCode}

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 “{customerCode}” marker in the given endpoint URL with the code of the customer you wish to update – you must also ensure the “customerId” and “customerCode” fields are correctly populated for the customer you wish to update. To ensure no data is lost please call the GET method to get the customer 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 Customer

End Point: https://api.myposconnect.com/api/v2/customers/{customerCode}

Verb: DELETE

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

Important: Replace the “{customerCode}” marker in the given endpoint URL with the code of the customer you wish to delete. If customer has transactions such as sales 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