D
D
DDwrt1002019-05-28 17:23:01
Spring
DDwrt100, 2019-05-28 17:23:01

Spring How to create complex Rest reference?

Good afternoon everyone. Maybe someone can tell me where to look.
There is a REST service that makes queries to the database using a link.
At the moment, about 6 variables need to be passed to this link.
At the same time, depending on the request, some variables may not be transmitted, for example, if the request is transmitted without a start date.
Link example.

service/{startTime}/{endTime}/{startResult}/{onPage}/{status}

And if you describe each case of passing a variable, then you get a lot of methods, and I'm not sure that this is the right way.
Is there a way to create a dynamic link?
Can you please tell me where to look?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-05-28
@DDwrt100

Pass parameters in the query string .

O
Orkhan Hasanli, 2019-05-28
@azerphoenix

Why do you want to pass data to PathVariable? Especially considering that pathvariable is required. It turns out that you will need to iterate over all possible combinations of pathvariable.
As for me, it's better to just use one url and process not pathvariable in the controller, but requestParam (required = false). And accordingly, pass everything you need in the body POST.
If I understood your task correctly... Only, if necessary, it is probably worthwhile
to implement obtaining a token for authorization and pass a bearer token in the header ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question