1
我對REST相當陌生,並且一直在努力繪製出與mySQL數據庫中的外鍵相關的對象的RESTful請求。用於相關對象的RESTful API
我有以下對象和它們的關係是線性順序:
Quiz_course [1]
Quiz_meta_block [2]
Quiz_block [3]
Quiz_question [4]
到目前爲止,我想出了以下GET
請求:
// Retrieve all quiz_course(s)
api/quiz_course/
// Retrieve quiz_course by id
api/quiz_course/{id}
// Retrieve all quiz_meta_blocks related to a quiz_course id
api/quiz_course/{id}/quiz_meta_block
// Retrieve a quiz_meta_block that is related to a quiz_course_id
api/quiz_course/{id}/quiz_meta_block/{id}
但後來我想,當撞牆得到quiz_questions:
// Retrieve all quiz_questions that is related to a quiz_course_id
api/quiz_course/{id}/quiz_meta_block/quiz_block/quiz_question/
我的表示是否準確?