While mostly every company got it's standard on APIs, the question just came out after that one of my colleagues stated we must use different object models for creating and getting objects from API.
To be clear, he states that when you want to get the object from the API you will receive an object like this:
{
id: '1111',
name: 'SomeName',
createdBy: '',
createdDate: '',
yitle: 'oh my titlte',
details 'Some Dets'
persons: 'whom may concern'
products: [{p1}, {p2}]
}
But when you want to create an object of the same entity you must send the following object to API:
{
name: 'blahbla',
title: 'valhvalh'
}
So you shouldn't send the properties that are not needed ass empty. Because i'm using C#
it's easier for me to work with one class
object for a known entity, so i think that when i want to create the object instance i can send the following object:
{
id: '',
name: 'SomeName',
createdBy: '',
createdDate: '',
title: 'oh my titlte',
details '',
persons: '',
products: ''
}
Mentioning that we don't have a high traffic and bandwidth is not issue i thought why we should do excess work to gain nothing but more complex code. He added this is an standard used in social medias too witch i myself could't agree on and could't provide any evidence.
The Question is that is this an standard in API's? and if yes what's the gain here and what is it for.