lundi 7 février 2022

Best practice around request body of Rest API

I just wanted to create a Rest API. But I'm confused with the request format. As per the current requirement, my API is needing an array of objects as input. Eg. [{'key':'value'},{'key':'value'},{'key':'value'}]

But I'm thinking to have it like

{
  'key':[{'key':'value'},{'key':'value'},{'key':'value'}]
}

Can someone help me with, what is the best practice for having the request format(Array of objects or wrapper around an array of objects).

Aucun commentaire:

Enregistrer un commentaire