interface APIClientInterface (View source)

A service responsible for communicating with a CKAN API endpoint

Constants

API_VERSION

The CKAN API version to communicate with

Methods

array
getData(Resource $resource, string $action = 'datastore_search', string $id = 'Identifier')

Performs a request to the CKAN API for the given {@link Resource} and returns the raw data result

array
getPackage(Resource $resource)

Performs a request to the CKAN API for the given {@link Resource} and returns the result. Uses the endpoint for "package_show".

array
getSearchData(Resource $resource)

Performs a request to the CKAN API for the given {@link Resource} and returns the raw data result. Uses the endpoint for "datastore_search".

Details

array getData(Resource $resource, string $action = 'datastore_search', string $id = 'Identifier')

Performs a request to the CKAN API for the given {@link Resource} and returns the raw data result

Parameters

Resource $resource
string $action

The CKAN API action to use

string $id

The {@link Resource} field to use as the "id" argument

Return Value

array

The output from the CKAN API

Exceptions

RuntimeException

If API communication fails for some reason

array getPackage(Resource $resource)

Performs a request to the CKAN API for the given {@link Resource} and returns the result. Uses the endpoint for "package_show".

Parameters

Resource $resource

Return Value

array

The output from the CKAN API

Exceptions

RuntimeException

If API communication fails for some reason

array getSearchData(Resource $resource)

Performs a request to the CKAN API for the given {@link Resource} and returns the raw data result. Uses the endpoint for "datastore_search".

Parameters

Resource $resource

Return Value

array

The output from the CKAN API

Exceptions

RuntimeException

If API communication fails for some reason