Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can query parameters be mandatory in REST API [closed]

I have a requirement which says there has to be two parameters(one of them represents date) that are part of the GET URI have to be mandatory. But these two parameters are only for filtration purpose. So my question is, Can mandatory parameters be used as Query params? (Or we can still use them as path params although there is no parent/child relationship)

like image 809
Satej Avatar asked Oct 17 '25 16:10

Satej


1 Answers

Yes, mandatory parameters can be used in query parameters. In that case you need to put a validation after the API is hit to check whether the value of the parameter is not null and is of specified format. In case they fail to mention even the query parameter variable in the path, then they will end up receiving 404 error.

like image 51
Mollishree Soor Avatar answered Oct 20 '25 05:10

Mollishree Soor