Published on InterSystems Developer Community (https://community.intersystems.com)

Home > How do you search with REST

Question
Eduard Lebedyuk · Oct 12, 2019

How do you search with REST

The question is pretty much in title. I'm developing a REST API, it has a search endpoint with 10 optional parameters. How do I pass them and stay RESTFul?

To ease the question a bit let's agree that:

  • all parameters are AND parameters, user can't make combos, ORs, etc. User can only provide values
  • all values are integers so I don't have to think about URL limits
  • all values are atomic
  • all conditions are about equivalency

Some options I know of:

1. URL parameters.

GET /search?param1=value1&param2=value2...

Quick and easy but I'm not sure it's really RESTFul

2. POST body

POST /search
{
   "param1": "value1",
   "param2": "value2"
}

Looks like a lot of overhead?

 

Any other ideas?

#REST API #InterSystems IRIS

Source URL:https://community.intersystems.com/post/how-do-you-search-rest