Skip to content
Developerhome

apiPut

  Less than to read

Summary

The apiPut method is used to update a single item at the backend API using the data from the Redux store.

This method assumes that you have retrieved the item data using apiGet and have made modifications to the screen. It expects the data to be in an unpacked format with a specified prefix, which allows for seamless binding to the screen controls. Additionally, the method utilises the metadata stored in the Redux store to ensure the accuracy of the data types and maximum string lengths.

For correct usage of apiPut, it’s imperative to initially call apiGetMetadata followed by apiGet, ensuring the groundwork for proper apiPut functionality.

apiPut Parameters

Parameters Description
endpoint The URL for Sage 200 API endpoint that you require (e.g. v1/departments or v1/customers)
id The ID of the item to be updated.
prefix (Optional) A prefix to separate the data in the Redux store.

apiPut Example

"apiPut": {
  "endpoint": "v1/departments",
  "prefix": "prefix",
  "id": {
    "get": {
      "state": "prefix/dept_id"
    }
  }
}