# Agent

Provider API v0.6.7 · 2 operations
Source: https://plasapi.com/provider/v0.6.7/agent/

The people and organisations connected to works, such as authors, illustrators, translators, narrators and publishers. The vendor can fetch an agent by ID or search for agents by name, and see which works they are connected to and in which role.

## Get agents

`GET` `/agent` · `GetAgents`

### Example request

**cURL**

```bash
curl -X GET "$PLAS_BASE_URL/agent?agent_ids=agent-4102&version=0.6.7" \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN"
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/agent?agent_ids=agent-4102&version=0.6.7`, {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.get(
    f"{os.environ['PLAS_BASE_URL']}/agent",
    params={
        "agent_ids": "agent-4102",
        "version": "0.6.7",
    },
    headers={
        "Accept": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

- `agent_ids` (In `query`, `array of string`, required) — A list of agent IDs, agent IDs should be url encoded and separated by a comma.

That means that, if you have e.g. three agent IDs "agent-123", "agent-456,abcd" and "789101112", they should be sent as: "agent_ids=agent-123,agent-456%2Cabcd,789101112".


Shared across operations: `ui_language`, `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

### Responses

#### `200` Success

`GetAgentsResponseBody`

Example (Generated from the schema):

```json
{
  "agents": {
    "agent-4102": {
      "description": "Norwegian novelist, awarded the Nobel Prize in Literature in 1928.",
      "fullName": "Sigrid Undset",
      "id": "agent-4102",
      "images": [
        {
          "height": 1200,
          "mime": "png",
          "url": "https://images.nordby.bibliotek.example/covers/310552.jpg",
          "width": 800,
          "type": "agent"
        }
      ],
      "active": {
        "type": "literal",
        "value": "1882-1949"
      },
      "birthDate": {
        "type": "literal",
        "value": "1920"
      },
      "deathDate": {
        "type": "literal",
        "value": "1920"
      },
      "externals": {
        "identifiers": [
          {
            "type": "norwegianAuthorityFile",
            "value": "4102"
          }
        ]
      },
      "givenName": "Kari",
      "surname": "Nordmann",
      "type": "person"
    }
  }
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

#### `404` Resource not found.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

## Search Agents

`GET` `/agent/search` · `SearchAgents`

### Example request

**cURL**

```bash
curl -X GET "$PLAS_BASE_URL/agent/search?version=0.6.7" \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN"
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/agent/search?version=0.6.7`, {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.get(
    f"{os.environ['PLAS_BASE_URL']}/agent/search",
    params={
        "version": "0.6.7",
    },
    headers={
        "Accept": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

- `query` (In `query`, `string`, optional) — Search agents.
- `page` (In `query`, `integer`, optional) — Page number (default 1).
- `size` (In `query`, `integer`, optional) — Page size (default 10).
- `types` (In `query`, `array of string`, optional) — List of agents types allowed in result.

Shared across operations: `ui_language`, `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

### Responses

#### `200` Success

`SearchAgentsResponseBody`

Example (Generated from the schema):

```json
{
  "results": [
    {
      "description": "Norwegian novelist, awarded the Nobel Prize in Literature in 1928.",
      "fullName": "Sigrid Undset",
      "id": "agent-4102",
      "images": [
        {
          "height": 1200,
          "mime": "png",
          "url": "https://images.nordby.bibliotek.example/covers/310552.jpg",
          "width": 800,
          "type": "agent"
        }
      ],
      "active": {
        "type": "literal",
        "value": "1882-1949"
      },
      "birthDate": {
        "type": "literal",
        "value": "1920"
      },
      "deathDate": {
        "type": "literal",
        "value": "1920"
      },
      "externals": {
        "identifiers": [
          {
            "type": "norwegianAuthorityFile",
            "value": "4102"
          }
        ]
      },
      "givenName": "Kari",
      "surname": "Nordmann",
      "type": "person"
    }
  ],
  "total": 12
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)

#### `404` Resource not found.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.7/)
