# REST API (deprecated)

{% hint style="danger" %} <mark style="color:orange;">Our REST API is deprecated and is replaced by our</mark> [graphql-api](https://docs.iadvize.dev/technologies/graphql-api "mention")
{% endhint %}

## Base URL <a href="#base-url" id="base-url"></a>

All URLs referenced in the documentation have the following base:

| Standard platform              | High availability platform     |
| ------------------------------ | ------------------------------ |
| `https://sd.iadvize.com/api/2` | `https://ha.iadvize.com/api/2` |

The iAdvize REST API is served over HTTPS.

## Authentication <a href="#authentication-rest" id="authentication-rest"></a>

The API key must be attached to each request. You can use it in one of the following ways:

* Passed in as a `X-API-Key` HTTP header
* Passed in as a `key` GET parameter
* Passed in as the username (with an arbitrary password) via `HTTP Basic authentication`

## Calls, errors & responses <a href="#calls-errors-and-responses" id="calls-errors-and-responses"></a>

### **Authentication failed**

```
{
  meta: {
    status: "error",
    message: "Forbidden"
  }
}
```

### **Read**

**`GET /my_resource`**

```
{
  meta: {
    status: "success"
  },
  data: [
    {
      id: 789,
      _link: "/my_resource/789"
    },
    {
      id: 456,
      _link: "/my_resource/456"
    },
    {
      id: 123,
      _link: "/my_resource/123"
    }
  ],
  pagination: {
    page: 1,
    pages: 1,
    limit: 20,
    count: 3
  }
}
```

#### **Common filters**

| Filter | Description                                                          | Values     |
| ------ | -------------------------------------------------------------------- | ---------- |
| page   | Page number                                                          | `?page=1`  |
| limit  | Maximum number of resources per page (maximum possible value is 100) | `?limit=1` |
| full   | Show all fields of the resource                                      | `?full=1`  |

Use the `*` character to broaden the scope of your search. E.g.: `filters[name]=*uli*`

**`GET /my_resource/123`**

```
{
  meta: {
    status: "success"
  },
  data: {
    id: 123,
    my_field: "my_value",
    _link: "/my_resource/123"
  }
}
```

**`GET /my_resource/456` (with error)**

```
{
  meta: {
    status: "fail",
    message: "Unknown 'my_resource' with 'id' 456."
  }
}
```
