loading...

API Design Tip

victoromondi1997 profile image VICTOR OMONDI ・1 min read

Don't keep Important informations as top level object key, cause then the client has to iterate through the object, find the key, relevent to him, at the same time discard the other irrelevant keys and then extract the data.

DO NOT PUT IMPORTANT DATA AS OBJECT KEYS

I faced this issue with my AI team, and had to spend a fuckload of time parsing the response

BAD RESPONSE DATA:

{
 "i_am_a_unique_id": 50
}

GOOD RESPONSE DATA

{
 "id": "i_am_a_unique_id",
 count: 50
}

Discussion

pic
Editor guide