Sage 200 API Client error: To save this line you must enter a quantity greater than zero

Posted on June 20, 2023
Message":"To save this line you must enter a quantity greater than zero" - what does this mean?

Client error: `POST https://api.columbus.sage.com/uk/sage200extra/accounts/v1/sop_orders` resulted in a `400 Bad Request` response: {“Message”:”To save this line you must enter a quantity greater than zero.”}

If you try to save an order into Sage 200 using the sop_orders endpoint and the API returns a 400 Bad Request HTTP response with a message saying “To save this line you must enter a quantity greater than zero.” then this means that one of the order line items within the order is causing this exception.

Unfortunately, the error is not very specific and indicate which order line item is causing the issue.

Solution:

The Sage 200 API help page entitled What makes up an API request (see Sage APIs) at the bottom of the page it lists the different HTTP Response Codes returned when you make an API request. The 400 Bad Request response says “This occurs if the data that you are sending over is malformed or contains invalid fields and values. The API will attempt to return meaningful error messages relating to the cause of the first error it encounters. It is common for this to occur if incorrect foreign IDs are supplied in the body of a request.”

This seems to refer to foreign IDs it is just referring to the IDs contained in the JSON body of the request e.g. customer_id, product_id etc.

Maybe you should investigate the IDs contained in the body for the product codes that fail and compare / check them against the product codes that are successful such as pricing_unit_id, selling_unit_id etc.

A potential issue for this error message is that the precision for pricing units and selling units are wrong. For example: a 10 pack has been entered as 10.0000 and this should be 1.0000.

Have Questions?

How can automation help?

Automation helps your business become more efficient and perform better with less resources. So you can reduce on costs and time spent on repetitive menial tasks. Think of automation as a “Robot” that works 24/7 to improve your business performance, without the overheads of employing extra staff.