Endpoint accept object and object array

Asked

Viewed 83 times

1

This is a question that refers more to good practices.

The scenario is that I have 2 endpoints to receive a given record. In the first I receive the object and register one by request. In the second I receive an array of this object, section and register one at a time.

My question is whether there is a convention on whether I should unite these two endpoints or continue to offer a service for joint and individual registration.

  • 1

    Unless there is a very strong reason for you to have these 2 endpoints separated, why not simply offer multiple registration? I think it is not so much following or not some convention, but facilitating the maintenance of your code, avoiding code duplicity (I believe you have separate methods, and almost equal, to treat each endpoint) and the potential for bugs if you have to update this logic.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.