-1

I have an endpoint that takes a list of email address (could be a very long list) and finds users with that email. What HTTP verb is best for this?

I am thinking GET as there is no backend mutation but is GET ideal for sending this kind of data to the server?

16kb
  • 889
  • 9
  • 17
  • How are you sending the data? A GET method wouldn't have a body, but would accept query parameters. GET makes the most sense to me based on what the request does. – jmoney Dec 03 '18 at 05:47
  • That is another problem. How do I send a list with `GET` in an ideal and scalable way – 16kb Dec 03 '18 at 05:48
  • I think that's a matter of opinion from what I've seen. You could specify the query parameter be comma separated. Or send duplicate query parameters, take a look at https://stackoverflow.com/questions/11621477/using-duplicate-parameters-in-a-url the second answer specifically. – jmoney Dec 03 '18 at 05:55

1 Answers1

2

As you are only searching based on free-text I would suggest using GET, it covers everything you need. Your method is not creating/updating/deleting any data, simply collecting and passing it back. This is exactly the purpose of the GET method.

Scott Evans
  • 374
  • 1
  • 10