Put ODS page
put_ods_page.RdSend JSON element to a page from an Opendatasoft platform.
Arguments
- page_slug
Slug of the page (in the backoffice of the platform -> Pages -> New or existing page -> Properties -> Page URL).
- json_to_send
JSON object containing page information, such as title, description, content and tags, that put_ods_page() sends on the page corresponding to the page slug.
Value
If request is successful (i.e. the request was successfully performed and a response with HTTP status code <400 was received), an HTTP response; otherwise it throws an error.
Examples
if (FALSE) {
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to=dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
body_and_style <- get_body_and_style(path)
page_elements <- get_ods_page(page_slug)
json_to_send <- create_json(page_elements, body_and_style, chosen_languages = c("en", "fr"),
title = "English title", description = NULL,
tags = NULL, restricted = NULL)
put_ods_page(page_slug, json_to_send)
}