Skip to contents

This function returns a single URL to connect to a chosen EES API endpoint. The resulting URL can be used with GET or POST (as appropriate) in order to connect. Whether the publication_id or dataset_id (or neither) parameter are required depends on the endpoint chose.

Endpointsid required
get-publicationsNeither
get-data-cataloguepublication_id
get-summary, get-meta, get-csv, get-data, post-datadataset_id

Usage

api_url(
  endpoint = "get-publications",
  publication_id = NULL,
  dataset_id = NULL,
  indicators = NULL,
  time_periods = NULL,
  geographic_levels = NULL,
  locations = NULL,
  filter_items = NULL,
  dataset_version = NULL,
  ees_environment = NULL,
  api_version = NULL,
  page_size = NULL,
  page = NULL,
  verbose = FALSE
)

Arguments

endpoint

Name of endpoint, can be "get-publications", "get-data-catalogue", "get-summary", "get-meta", "get-csv", "get-data" or "post-data"

publication_id

ID of the publication to be connected to. This is required if the endpoint is "get-data-catalogue"

dataset_id

ID of data set to be connected to. This is required if the endpoint is one of "get-summary", "get-meta", "get-csv", "get-data" or "post-data"

indicators

Indicators required as a string or vector of strings (required)

time_periods

Time periods required as a string ("period|code") or vector of strings

geographic_levels

Geographic levels required as a string or vector of strings

locations

Location code required as a string or vector of strings

filter_items

Filter items required as a string or vector of strings

dataset_version

Version of data set to be connected to

ees_environment

EES ees_environment to connect to: "dev", "test", "preprod" or "prod"

api_version

EES API version

page_size

Number of results to return in a single query

page

Page number of query results to return

verbose

Run with additional contextual messaging. Logical, default = FALSE

Value

A string containing the URL for connecting to the EES API

Examples

api_url()
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/publications?"
api_url("get-publications")
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/publications?"
api_url("get-data-catalogue", publication_id = eesyapi::example_id("publication"))
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/publications/25d0e40b-643a-4f73-3ae5-08dcf1c4d57f/data-sets?"
api_url("get-summary", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/data-sets/e1ae9201-2fff-d376-8fa3-bd3c3660d4c8"
api_url("get-meta", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/data-sets/e1ae9201-2fff-d376-8fa3-bd3c3660d4c8/meta"
api_url("get-csv", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/data-sets/e1ae9201-2fff-d376-8fa3-bd3c3660d4c8/csv"
api_url(
  "get-data",
  dataset_id = eesyapi::example_id("dataset"),
  indicators = example_id("indicator"),
  time_periods = c("2024|W12", "2024|W13"),
  geographic_levels = c("NAT"),
  filter_items = example_id("filter_item")
)
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/data-sets/e1ae9201-2fff-d376-8fa3-bd3c3660d4c8/query?timePeriods.in=2024|W12%2C2024|W13&geographicLevels.in=NAT&filters.in=VN5XE&indicators=dPe0Z"
api_url(
  "post-data",
  dataset_id = eesyapi::example_id("dataset"),
  indicators = example_id("indicator")
)
#> [1] "https://test.statistics.api.education.gov.uk/api/v1.0/data-sets/e1ae9201-2fff-d376-8fa3-bd3c3660d4c8/query"