File tree Expand file tree Collapse file tree
docs/apis/subsystems/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,3 +127,19 @@ All of these methods also accept:
127127
128128- any headers to provide with your request
129129- any query parameters
130+
131+ As an example, to call the route ` /api/rest/v2/question/bank/{course}/question_counts ` , you would do the following:
132+
133+ ``` php title="Creating and processing a question_counts request"
134+ public function test_question_counts(): void {
135+ $this->resetAfterTest();
136+ $course = self::getDataGenerator()->create_course();
137+
138+ $this->add_class_routes_to_route_loader(
139+ \core_question\route\api::class,
140+ \core\router\route_loader_interface::ROUTE_GROUP_API, // This is implied for routes in an `api` namespace, but must be set for other route groups.
141+ );
142+
143+ $response = $this->process_api_request('GET', "/bank/{$course->id}/question_counts");
144+ }
145+ ```
You can’t perform that action at this time.
0 commit comments