javascript - Handling search parameters URL PHP
Get the solution ↓↓↓I am wondering if I would be able to get some advice.
I am trying to build a search for my site and I want to link to be reusable so it can be sent as a link to someone else to see the same results.
The problem I have is that there is the possibility to have 100s of parameters for this search, so I dont think a GET requests in the URL are the right way to go.
I was thinking of the possibility of creating a JSON file that saves the parameters in the search and to give it a specific name say "qwer-eweq-qwe" then the URL link could be www.mysite.com/qwer-eweq-qwe
Then once a user would navigate to the URL it would then read the JSON file and pull the correct parameters.
Is there any other ways I could do this? Can seem to find too much online. any pointers would be very helpful
Thanks,
Richard
Answer
Solution:
With so many parameters, please, consider switching way of dealing with it.
An idea would be to use a filter system. One POST method would create a filter with a set of parameters in body (either raw or JSON, does not matter).
POST /filter
The call would create (or not, if already exists) a filter. The call would return a filter ID that you can use to search by fixed parameters:
GET /search/:filterid
That way, you even can manage cache limitations depending on filters, by invalidating those if needed.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: object not found by the @paramconverter annotation.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.