Answer the question
In order to leave comments, you need to log in
How to properly organize nested url in rest api?
Hello, there are 4 tables with such links:
How to display these links in addresses?
I tend to use nested URLs, for example:
http://site.ru/api/courses/1/categories/2/lessons/1/
http://site.ru/api/courses/1/categories/2/tasks/1/
http://site.ru/api/course-categories/1/?course_id=1
http://site.ru/api/course-lessons/1/?course_id=1&course_category_id=1
Answer the question
In order to leave comments, you need to log in
It's probably easier to post a request, and there already specify the parameters, as social networking apis often use, because you can go crazy writing rules for urlManager.
But in any case, there is no reason to use CNC for api. For the controller and action - ok, and the parameters should definitely be used like this:?course_id=1&course_category_id=1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question