# When Steps

### When I GET `{uri}` <a href="#when-i-get-uri" id="when-i-get-uri"></a>

To perform a simple GET request, we use this When step.

```
Scenario: Getting user information 
    Given that a endpoint is up at mydomain.com
    Given I set Content-Type header to application/json
    Given I set DocId header to 3001
    When I GET /users/info
```

### &#x20;<a href="#when-i-post-to-uri" id="when-i-post-to-uri"></a>

### When I POST to `{uri}` <a href="#when-i-post-to-uri" id="when-i-post-to-uri"></a>

To submit a POST request, this step will help us.

```
Scenario: Creating a new task 
    Given that a secure endpoint is up at mydomain.com
    Given I set Content-Type header to application/json
    Given I set the JSON body to 
    """
    `{
        "name": "New Task",
        "priority": 1,
        "notes": "Go document things"
    }`
    """
    When I POST to /tasks
```

### &#x20;<a href="#when-i-put-to-uri" id="when-i-put-to-uri"></a>

### When I PUT to `{uri}` <a href="#when-i-put-to-uri" id="when-i-put-to-uri"></a>

With this step we can do a simple PUT

```
Scenario: Creating a new task 
    Given that a secure endpoint is up at mydomain.com
    Given I set Content-Type header to application/json
    When I PUT to /tasks
```

### &#x20;<a href="#when-i-perform-delete-to-uri" id="when-i-perform-delete-to-uri"></a>

### When I perform DELETE to `{uri}` <a href="#when-i-perform-delete-to-uri" id="when-i-perform-delete-to-uri"></a>

Performing a DELETE request is simple as using this step

```
Scenario: Delete a task 
    Given that a secure endpoint is up at mydomain.com
    Given I set Content-Type header to application/json
    Given I set query parameter taskId to 1001
    WHEN I perform DELETE to /tasks
```

### &#x20;<a href="#when-i-patch-to-uri" id="when-i-patch-to-uri"></a>

### When I PATCH to `{uri}` <a href="#when-i-patch-to-uri" id="when-i-patch-to-uri"></a>

When you need to use the PATCH method us this step.

```
Scenario: Some patch request 
    Given that a secure endpoint is up at mydomain.com
    Given I set Content-Type header to application/json
    WHEN I PATCH to /patch/uri
```


---

# 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://autokin.gitbook.io/docs/autokin-rest/when-steps.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.
