# GET

#### Overview

This document serves as a guide for automating a simple GET request API without authentication. The API endpoint used in this tutorial is `https://api-generator.retool.com/7kbSLy/data/1`, which is designed to return data for a specified ID.

#### Automating GET Request

**Step 1: Importing the cURL command into Postman**

The cURL command for the GET request is as follows:

```
curl --location --request GET 'https://api-generator.retool.com/7kbSLy/data/1'
```

Upon importing this cURL into Postman, it translates into an interface with the request and response sections, as seen in the screenshot.

<figure><img src="https://1894392350-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiGaaGnfeM1ej74weWKLs%2Fuploads%2Fge6psDUjJBlginQDDatg%2FScreenshot%202023-12-21%20at%2011.42.18%20PM.png?alt=media&#x26;token=a1f899a3-ba33-4c9f-bab4-f11ad8869638" alt=""><figcaption></figcaption></figure>

**Step 2: Template for Scriptless Automation**

To automate the example without writing scripts, the following template can be used:

```
DEPENDANT_TEST_CASE,NONE,
END_POINT,https://api-generator.retool.com/7kbSLy/data/1,
METHOD,GET,
PARAMS:KEY,NONE,
PARAMS:VALUE,NONE,
AUTH:KEY,NONE,
AUTH:VALUE,NONE,
HEADERS:KEY,NONE,
HEADERS:VALUE,NONE,
BODY:KEY,NONE,
BODY:VALUE,NONE,
RESPONSE:CODE,200,
RESPONSE:JSON_PATH,NONE,id,'Column 1'
RESPONSE:EXPECTED_VALUE,NONE,1,Aigneis Ravillas
RESPONSE:STORE_VALUE,NONE,NONE,NONE
```

This template sets up a test for the GET request by specifying the endpoint, method, parameters, and the expected response.

<figure><img src="https://1894392350-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiGaaGnfeM1ej74weWKLs%2Fuploads%2FapMWWls8QjnKZlgpmfy9%2FScreenshot%202023-12-28%20at%201.06.47%20AM.png?alt=media&#x26;token=c5ae3025-8a9e-4eaf-966e-4d195a4195a5" alt=""><figcaption><p>Automation view</p></figcaption></figure>

**Step 3: Execution and Report Generation**

When the test case is executed using the template, the automation tool generates a report that records each step performed during the test. The report includes:

* The type of request and the endpoint used.
* The type of request and the response received.
* Validation of the response code.
* Validation of response elements (shown with Pink/Green arrows in the below\` screenshot).

<figure><img src="https://1894392350-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiGaaGnfeM1ej74weWKLs%2Fuploads%2FBm20z1ViLpJFIVR8ARYD%2FScreenshot%202023-12-28%20at%201.09.51%20AM.png?alt=media&#x26;token=ddeb7fef-095d-41f2-9b3b-555a717aca9c" alt=""><figcaption></figcaption></figure>

**Relaxed HTTPS Validation**

For environments where HTTPS certificate validation is not required, or in cases where self-signed certificates are in use, the automation tool supports relaxed HTTPS validation. This means the tool will not enforce strict validation of the SSL certificate, allowing the GET request to proceed even if the SSL certificate cannot be validated. To use the Relaxed HTTPS for GET request change GET -> RELAX\_GET, below is the example.

```
DEPENDANT_TEST_CASE,NONE,
END_POINT,http://api-generator.retool.com/7kbSLy/data/1,
METHOD,RELAX_GET,
PARAMS:KEY,NONE,
PARAMS:VALUE,NONE,
AUTH:KEY,NONE,
AUTH:VALUE,NONE,
HEADERS:KEY,NONE,
HEADERS:VALUE,NONE,
BODY:KEY,NONE,
BODY:VALUE,NONE,
RESPONSE:CODE,200,
RESPONSE:JSON_PATH,NONE,id,'Column 1'
RESPONSE:EXPECTED_VALUE,NONE,1,Aigneis Ravillas
RESPONSE:STORE_VALUE,NONE,NONE,NONE
```

#### Validating the Response

The automation checks for:

* The HTTP status code, which is expected to be `200`.
* The presence and value of `id` and `Column 1` in the JSON response.

The expected value for `Column 1` in the response is "Aigneis Ravillas" for the ID "1".
