This might be a really simple question but I can’t seem to find a definitive answer. I want to know from a API best practice point of view, should you send over empty fields (empty string or null) or should you omit them from the API altogether?
I’ve looked at other APIs and I can see empty fields being sent over. Also, to me sending over empty field also shows the consumer what is available in the API, but on the flip side it’s extra data for no reason.
Anyone know if there’s a correct answer/best practice?
I’m not sure whether this would be considered best practice by all, but from my experience the best option is you only require the client to send the data they need to. So if you have fields that can be blank or null then they don’t need to be sent by the requester.