# Requests

### Making a Request

#### Host

The host for Web API v1 requests is always `https://api.iafcertsearch.org/api/client/v1`

{% hint style="info" %}
All requests must be made over HTTPS. The API does not support HTTP.
{% endhint %}

#### Authorization Header

You must provide an authorization header as described in [Authentication](https://support.iafcertsearch.org/api-developer-guide/api-integration/broken-reference).

#### HTTP Verbs

* `GET` Retrieve a resource or group of resources
* `POST` Create a new resource
* `PUT` Update an existing resource
* `DELETE` Delete an existing resource
* `OPTIONS` View allowed verbs against a specific resource

#### Accept Header

The API provides JSON responses. It doesn’t currently require the accept header, but might in the future. If not set, the API will use `application/json`.

```http
GET https://api.iafcertsearch.org/api/client/v1/endpoint HTTP/1.1
Accept: application/json
```

#### Arrays of Data

When you send an array of data in a `GET` request, you will include the parameter multiple times on the URL. The parameter name does not require brackets.

```http
GET https://api.iafcertsearch.org/api/client/v1/endpoint?parameter=data1&parameter=data2 HTTP/1.1
```

### Formatting Your Request

#### Request Body

When submitting data to a resource via `POST` or `PUT`, you must submit your payload in JSON.

```http
POST https://api.iafcertsearch.org/api/client/v1/example/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "name": "new example name"
}
```

#### Pagination

Some `GET` resources allow for retrieval of information in batches. We will provide the query parameters in the resource documentation when applicable.

When requesting multiple items, we will default the request `limit` to `20` items. You can specify a different limit using the `limit` parameter when you need to. The maximum value for the `limit` parameter that we accept is `100`.

Below you can see an example of an API request which retrieves the first 100 records as specified by the `limit=100` and `offset=0` parameters.

To retrieve the next batch of records, increment the offset parameter by `1`.

```http
GET https://api.iafcertsearch.org/api/client/v1/resource?limit=100&offset=0 HTTP/1.1
```

### Successful Requests

| **Verb** | **Resource object returned**                                  |
| -------- | ------------------------------------------------------------- |
| GET      | Returns a single resource object or array of resource objects |
| PATCH    | Returns the updated resource object                           |
| PUT      | Returns the updated resource object                           |
| DELETE   | No content is returned                                        |
| POST     | Returns the newly created resource object                     |
