Title: | 'REST' API Client for Accessing Data on 'WEkEO HDA V2' |
---|---|
Description: | Provides seamless access to the WEkEO Harmonised Data Access (HDA) API, enabling users to query, download, and process data efficiently from the HDA platform. With 'hdar', researchers and data scientists can integrate the extensive HDA datasets into their R workflows, enhancing their data analysis capabilities. Comprehensive information on the API functionality and usage is available at <https://gateway.prod.wekeo2.eu/hda-broker/docs>. |
Authors: | Matteo Mattiuzzi [aut, cre] |
Maintainer: | Matteo Mattiuzzi <[email protected]> |
License: | EUPL (>= 1.2) |
Version: | 1.0.4 |
Built: | 2025-03-13 13:48:20 UTC |
Source: | https://github.com/eea/hdar |
Authorization
new()
This function initializes a new instance of the 'Auth' class with the specified parameters.
Auth$new(user = NULL, password = NULL)
user
A character string representing the username for authentication.
password
A character string representing the password for authentication.
An instance of the 'Auth' class.
token()
This function retrieves a previously generated token.
Auth$token()
A character string representing the retrieved token.
get_token()
This function generates a unique token for authentication or other purposes.
Auth$get_token()
A character string representing the generated token.
clone()
The objects of this class are cloneable with this method.
Auth$clone(deep = FALSE)
deep
Whether to make a deep clone.
The Client is the central gateway for interfacing with the HDA Service. It provides a comprehensive suite of methods to perform operations and retrieve data from the service efficiently.
apiUrl
API endpoint
new()
Constructor for the 'Client' class. Initializes a new instance with authentication credentials.
Client$new(user, password, save_credentials = FALSE)
user
Character string representing the username for authentication.
password
Character string representing the password for authentication.
save_credentials
A logical value indicating whether to save the credentials to a configuration file. Default is FALSE.
An instance of the 'Client' class.
token()
Retrieves the current authentication token.
Client$token()
Character string representing the authentication token.
get_token()
Generates a new authentication token.
Client$get_token()
Character string representing the newly generated token.
send_request()
Sends a specified request to the server and returns the response.
Client$send_request(req, raw_response = FALSE)
req
A request object or list representing the HTTP request.
raw_response
Optional logical value indicating whether the raw response should be returned instead of the parsed body.
A response object containing the server's response.
show_terms()
This function displays the terms and conditions for the services.
Client$show_terms()
An HTML document containing the terms and conditions in a collapsible format.
terms_and_conditions()
Function to retrieve and accept terms and conditions. Accepting T&C is permanent,
it is enough to run this function one.
To read T&C see show_terms
.
Client$terms_and_conditions(term_id, reject = FALSE)
term_id
A character vector of term_ids that you wish to accept. If missing current status is returned. Use "all" if you want to accept all terms at once.
reject
Logical, default 'FALSE'. If TRUE it inverts the operation and the provided term_id's are rejected/revoked.
A data frame reflecting the actual acceptance status for each term.
datasets()
Lists datasets available on WEkEO, optionally filtered by a text pattern.
Client$datasets(pattern = NULL)
pattern
Optional character string to filter dataset names by matching text.
List containing datasets and associated information.
search()
This function performs a search based on a specified query and returns an instance of SearchResults
.
Client$search(json_query, limit = NULL)
json_query
Character string representing the search query.
limit
Optional; a number specifying the maximum number of results to return.
An instance of the SearchResults
class containing the search results.
get_querytemplate()
Retrieves the raw query metadata for a specified datasetId.
Client$get_querytemplate(datasetId, to_json = FALSE)
datasetId
Character, representing the dataset's identifier.
to_json
Logical; if 'TRUE', returns the data in JSON format.
List or JSON file containing the raw query options.
generate_query_template()
This function generates a query template based on a specified datasetId.
Client$generate_query_template(datasetId)
datasetId
A numeric or character ID representing the dataset.
A JSON representing the generated query template.
clone()
The objects of this class are cloneable with this method.
Client$clone(deep = FALSE)
deep
Whether to make a deep clone.
There are some inconsistencies between the return of 'GET querymetadata' and what must be submitted to the HDA.
Use generate_query_template
to resolve these inconsistencies.
show_terms
to read the Terms and conditions.
SearchResults
for details on the returned object.
This class handles the storage and manipulation of search results including downloading resources based on a search query.
SearchResults
results
Stores the search results data.
total_count
Stores the total count of results' element.
total_size
Stores the total size of results
new()
Initializes a new SearchResults object with the specified client, results, and dataset identifier.
SearchResults$new(client, results, dataset_id)
client
An object containing the API client used to interact with the dataset.
results
List containing search results.
dataset_id
The identifier for the dataset being queried.
SearchResult instance
download()
Downloads resources based on stored results or selected indices of results.
SearchResults$download( output_dir, selected_indexes, stop_at_failure = TRUE, force = FALSE )
output_dir
A string specifying the directory where downloaded files will be saved.
selected_indexes
Optional; indices of the specific results to download.
stop_at_failure
Optional; controls whether the download process of multiple files should immediately stop upon encountering the first failure.
force
Optional; forces the download even if the file already exists in the specified output directory.
Nothing returned but downloaded files are saved at the specified location.
clone()
The objects of this class are cloneable with this method.
SearchResults$clone(deep = FALSE)
deep
Whether to make a deep clone.