Skip to content
Developerhome

apiGetCollection

  Less than to read

Summary

The apiGetCollection method is used to retrieve a collection of data from the API endpoint. It allows you to fetch multiple items and store them in the Redux store for use in a grid or component. In this guide, we’ll explore the parameters and how to use them effectively.

What does apiGetCollection do?

The apiGetCollection method retrieves data from the API endpoint as a collection and stores it in the Redux store. It is typically used to fetch multiple items that are displayed in a grid or require bulk processing. By using apiGetCollection, you can ensure that the fetched data is available for further manipulation and interaction.

apiGetCollection is typically used in conjunction with apiPutCollection and should be employed after invoking apiGetMetadata to establish the structure of the API request.

apiGetCollection Parameters

Parameters Description
endpoint The URL for Sage 200 API endpoint that you require (e.g. v1/departments or v1/customers)
key The key under which the collection will be stored in the Redux store.
prefix (Optional) A prefix to separate the data in the Redux store.
queryParms (Optional) Additional query parameters to be included in the request. (eg $select, $filter, $expand)

apiGetCollection Example

"apiGetCollection": {
  "endpoint": "v1/departments",
  "prefix": "myPrefix",
  "key": "departments"
}