I am building out a REST API and was wondering if there is any disadvantage or recommendation against making multiple requests or one request that returns an array of objects. I searched around and wasn't able to find discussions about this, so I apologize if it is out there.
For example:
Multiple Requests:
GET#1
[ { "colors": ['blue','red','green'] } ]
GET#2
[ { "animals": ['dog','cat','bird'] } ]
GET#3
[ { "names": ['John','Jacob','Josh'] } ]
Or a single request:
GET#1
[
{
"colors": ['blue','red','green'],
"animals": ['dog','cat','bird'],
"names": ['John','Jacob','Josh']
}
]
Personally, I don't mind either way. I also think that there would not be any future issues if using dictionaries. I am more so curious to know if this is looked down upon, indifferent, or even recommended.
To further clarify, the data will be related. I was looking for both general opinion as well as technical details, i.e. one request can be x time faster than trying three requests.