Skip to content
Developerhome

Utilising the Sage 200 API

  Less than to read

If you have followed our previous guides on adding a textbox to the new supplier and amending supplier screen, you should now have a functional textbox that saves data to the spare_text_1 field.

 {
          "Textbox": {
            "id": "spare_text_1",
            "label": "Spare Text 1 Textbox",
            "disabled": true,
            "mt": 2
          }
        }

In this guide, we’ll explore how to use the Sage 200 API to retrieve and post data to this custom field. To get the most out of the API and understand its capabilities, you can refer to the Sage 200 API documentation, which provides comprehensive details on available endpoints and operations.

Retrieving and Posting Data via the API

Any data entered into the spare_text_1 field will be stored and associated with the corresponding record in Sage 200. For instance, if you create a new supplier record and input a value into the Nickname field, it will be linked to that supplier and appear when you load the supplier in the amend supplier screen.

Now that your customisation is saving data to spare_text_1, you can leverage the Sage 200 API to interact with this data.

Data entered into the spare_text_1 field can be accessed via the Sage 200 API. For instance, you can use the GET request to retrieve this data from the suppliers endpoint:

GET/customers/{customerId}?$select=id,name,spare_text_1

Image

You can also POST data to the spare_text_1 field, allowing you to programmatically update this field. The data you post will be reflected on the Sage 200 web screen, enabling you to ensure consistency across the application.

Spare Field Limitations

Sage 200 API endpoints include several spare fields that you can use to develop your extenstion. The spare fields are detailed in the Sage 200 API Reference Endpoints.

For example, the Supplier endpoint includes the following fields:

Field Name        
spare_text_1 spare_text_2 spare_text_3 spare_text_4 spare_text_5
spare_text_6 spare_text_7 spare_text_8 spare_text_9 spare_text_10
spare_number_1 spare_number_2 spare_number_3 spare_number_4 spare_number_5
spare_number_6 spare_number_7 spare_number_8 spare_number_9 spare_number_10
spare_date_1 spare_date_2 spare_date_3 spare_date_4 spare_date_5
spare_bool_1 spare_bool_2 spare_bool_3 spare_bool_4 spare_bool_5

When developing and testing extensions using these fields, be aware that they may be used by other extensions on the same site. This could lead to conflicts, which can be mitigated by creating custom API fields or endpoints.

Want to Create Your Own API Fields or Endpoints?

With the release of Sage 200 Professional 2023 R2, it is now possible to extend existing Sage 200 endpoints to include additional custom fields and create new API endpoints for custom objects.

For detailed instructions on creating and extending or creating new API endpoints, please refer to the SDK Helpfiles. Access to these tools and resources is available exclusively to members of the UK Developer Programme. If you are interested in joining, please contact us.

Next - Next steps