The problem
As most of you, I guess know, it is not allowed to extend Business Central API's
This page type cannot be extended by creating a page extension object. Instead, you must create a new API by adding a page object
However, sometimes we just need to send more data about the entity: Customer, Vendor, Sales/Purchase documents etc.
Standard API's have limited number of fields. For example with /journalLines you can create a line with only 14 field values. However Gen. Journal Line table has more than 100 fields - only in the standard base, not speaking about additional possible table extensions. And usually you find yourself in a situation, when you've added some fields to the entity and want to fill them using API, like this guy. And once again we refer to the docs, saying
Instead, you must create a new API by adding a page object
Fair, but to clone the whole page object, just to add 1 field, and then keep it in synch with the next versions for the rest of your life? Not always the best-way-to-go.
What if..
For some of the API's I found another way. Still limited, but at least something. Let's return to the journalLines API. Among the allowed-to-fill fields there is one called comment. This is actually a free-text field with the length of 250 symbols
field(5618; Comment; Text[250])
Let's try
Add new fields
I added 3 fields to the General Journal Line
Send values with API
@commentValue = '{"myBooleanField":true,"myDecimalField":500.5,"myTextField":"someText"}'
*This post is locked for comments