The parameter length shouldn't be a problem to handle for the server.
You should read about how to design a rest api. I would recommend you to build it like this:
/api/{version}/{entity}/{id}
If you are using Spring Boot this is very simple to build.
Just write a Controller like this
@RestController
@RequestMapping("/api/users")
public class UsersService {
@Autowired
UsersRepository userRepo;
@RequestMapping(value="/find-all", method=RequestMethod.GET)
public Page<User> getAllUsers(@RequestParam(value="page", defaultValue = "0", required=false)Integer page,
@RequestParam(value="size", defaultValue= "20", required=false)Integer size){
...
}
@RequestMapping(value="/find/{id}")
public ResponseEntity<User> getUserById(@PathVariable(name="id")Long id){
...
}
@RequestMapping(value="/save", method=RequestMethod.POST)
public ResponseEntity<User> createUser(@RequestBody User user){
...
}
@RequestMapping(value="/delete/{id}", method = RequestMethod.GET)
public ResponseEntity<Void> deleteUser(@PathVariable(name="id")Long id){
...
}
}
Hope this sample code helps you to build your api. Just pass your ID as a PathVariable like shown in deleteUser()
or findUser()
.
If you need more Parameters, you can extend the list or use RequestParam like used in getAllUsers()
.
The parameters are optional but need a default value.