# Location

Provider API v0.6.7 · 1 operation
Source: https://plasapi.com/provider/v0.6.7/location/

The library's branches and the sections inside them, with their names and IDs, and which branch is the main one. Other endpoints refer to these IDs, for example the pickup location on a reservation and the place where a checkout or checkin happened.

## Get locations

`GET` `/locations` · `GetLocations`

Get all branches (libraries) that exist, and all sections of the branches. Sections is a natural division of the branches into smaller and 
smaller locations (such as floor and/or department, etc.), and each section is part of the path that describes an item's location in a library.  
Each section object contains the actual location values (e.g. a section of type "department" could contain the location values "adult", "youngAdult" and "children").


### Example request

**cURL**

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

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/locations?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']}/locations",
    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

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

### Responses

#### `200` Success

`LocationsResponseBody`

Example (Generated from the schema):

```json
{
  "branches": [
    {
      "coordinates": {
        "latitude": 59.9139,
        "longitude": 10.7522,
        "radius": 5000
      },
      "externals": {
        "identifiers": [
          {
            "type": "isil",
            "value": "0301"
          }
        ]
      },
      "id": "nordby-main",
      "name": "Nordby Main Library",
      "pickup": {
        "allow": true,
        "locations": [
          {
            "sections": [
              {
                "id": "nordby-main-children",
                "name": "Children’s department",
                "type": "department"
              }
            ]
          }
        ]
      },
      "tags": [
        "makerspace"
      ]
    }
  ],
  "mainBranch": {
    "branchId": "nordby-main",
    "branchName": "Nordby Main Library"
  },
  "pickupLocations": [
    {
      "branchId": "nordby-main",
      "branchName": "Nordby Main Library",
      "sections": [
        {
          "id": "nordby-main-children",
          "name": "Children’s department",
          "type": "department"
        }
      ]
    }
  ],
  "sections": [
    {
      "elements": [
        {
          "id": "nordby-main",
          "name": "Nordby Main Library",
          "parentId": "nordby-main"
        }
      ],
      "type": "department"
    }
  ]
}
```

#### `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/)
