HATEOAS API – best practice to create multiple entities in one request

  softwareengineering

I have a HATEOAS API (in ASP.NET) with an endpoint:
POST /api/messages – to create a new message and it returns the location of a new message

Now I have a requirement that in some cases based on message data, it should create multiple messages instead of one. So there is no single location to get a message.

What should I return when posting now to the endpoint which might have 1 or more created messages?

Should it be a location where I can get all new messages (messages could have some group ID)?

Or should I leave API as is and rely on the front-end to create each separate message? But then business logic will be in the front-end which I do not want and with multiple clients, they would have to implement the same logic too.

New contributor

MarisKs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT