How should I model this problem with REST API?

Write your response…

@ankitsinghaniyaz, when I try to visit the link I get an error saying 'Security token doesn't match, possible CSRF attack.' So, I am not quite sure what your example does. To me, the problem statement sounds like a web crawler. If that's the case, why do you say that GET/website_details? is not RESTful?

Going by specs, this is how a REST GET is defined:

The GET method requests transfer of a current selected representation for the target resource. GET is the primary mechanism of information retrieval

@ankitsinghaniyaz, Every object usually has two kind of GET routes - a getById route aka '/posts/:id' and a getS route aka '/posts'. Like @chilimatic says, you can use query parameters on a getS route and filter it according to what you need. It pretty much adheres to the REST specification.

Write a reply...

Join a friendly and inclusive Q&A network for coders

  • 🖥Pick the technologies you like & read great content through your feed.
  • 💬Ask a question when you want to learn more about anything.
  • 🚀Share what you know & build your portfolio.
Sign up nowLearn more

loading ...