Skip to contents

Creates a JSON-serialisable list describing all available API endpoints. Used to generate index.json at the API root.

Usage

generate_api_index(
  base_url = "https://johngavin.github.io/irishbuoys/api/v1/",
  endpoints = NULL
)

Arguments

base_url

Character, base URL for the API (default: "https://johngavin.github.io/irishbuoys/api/v1/")

endpoints

Named list of endpoint metadata. Each element should have description and optionally fields. If NULL, uses default endpoints.

Value

A list suitable for jsonlite::toJSON().

Examples

if (FALSE) { # \dontrun{
idx <- generate_api_index()
jsonlite::toJSON(idx, pretty = TRUE, auto_unbox = TRUE)
} # }