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-data, query-datadataset_id

Usage

api_url(
  endpoint = "get-publications",
  publication_id = NULL,
  dataset_id = NULL,
  dataset_version = NULL,
  page_size = NULL,
  page = NULL,
  api_version = "1.0",
  environment = "dev",
  verbose = FALSE
)

Arguments

endpoint

Name of endpoint, can be "get-publications", "get-data-catalogue", "get-summary", "get-meta", "get-data" or "query-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-data" or "query-data"

dataset_version

Version of data set to be connected to

page_size

Number of results to return in a single query

page

Page number of query results to return

api_version

EES API version

environment

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

verbose

Add extra contextual information whilst running

Value

A string containing the URL for connecting to the EES API

Examples

api_url()
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/publications?"
api_url("get-publications")
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/publications?"
api_url("get-data-catalogue", publication_id = eesyapi::example_id("publication"))
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/publications/b6d9ed96-be68-4791-abc3-08dcaba68c04/data-sets?"
api_url("get-summary", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/data-sets/d7329101-f275-d277-bbfe-d8cfaa709833/summary"
api_url("get-meta", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/data-sets/d7329101-f275-d277-bbfe-d8cfaa709833/meta"
api_url("get-data", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/data-sets/d7329101-f275-d277-bbfe-d8cfaa709833"
api_url("query-data", dataset_id = eesyapi::example_id("dataset"))
#> [1] "https://dev.statistics.api.education.gov.uk/api/v1.0/data-sets/d7329101-f275-d277-bbfe-d8cfaa709833/query"