How should I model this problem with REST API?

Responses (1)

Join the discussion

@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...

loading ...