简体   繁体   中英

Design a rest api which takes query param greater then some value

I want to design a rest api which takes a query param greater then some value.

Example:

/v1/credit/credits?total_amount>100

So here I want to fetch list of credits record greater then 100.

What would be the appropriate approach to pass this total_amount in query param.

As query parameters aren't SQL, the closest you can get is this:

/v1/credit/credits?min_total_amount=100

or

/v1/credit/credits?minTotalAmount=100

Camel- vs. snakecase is up to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM