# GET Requests

#### GET Request:

When calling a `get` method, two pieces of information are required:

1. The URL (This could also contain the query parameters)
2. The authentication token

**Example:**

```php
/**
 * Test that the GET /events returns 200
 *
 * @test
 * @return void
 */
public function events_get_method_index_returns_200(): void
{
	$this->actingAsAdmin()
          ->authenticate()
          ->get('/events');
}
```

The URL in this example is `/events`

{% hint style="success" %}
Use the method `->authenticate()` to authenticate the user, so the token does not have to be passed in the request.
{% endhint %}

**Example 2:**

```php
$this->actingAs(User::find(6))
  ->authenticate()
  ->get('/assessments/assessment-methods?course_id=2')
```

The value for “course\_id” is 2 within the URL

{% hint style="info" %}
The test does not call `$this->actingAsAdmin()` because the user in the test is not ***user 1*** (default administrator)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elentra.org/api/automated-testing/functional-tests/testing-http-verbs/get-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
