### OpenDataSoft now() Function Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates various ways to use the `now()` function to get the current date and time or to return a modified date and time by specifying parameters. These examples show how to set absolute values or adjust relative time components. ```text now() -- Returns '2021-05-06T12:34:55.450500+00:00' now(year=2000) -- Sets the year component to return '2000-05-06T12:34:55.450500+00:00' now(years=-1) -- Sets the year to one year ago which is '2020-05-06T12:34:55.450500+00:00' now(year=2001, months=-1) -- Sets the year to 2001 and subtract 1 month to return '2000-04-06T12:34:55.450500+00:00' now(day=31,month=2) -- Sets the day to 31, then the month to 2. The actual day part is rounded to 28 '2021-02-28T12:34:55.450500+00:00' now(weekday=0) -- Sets the day to the next Monday which is '2021-05-10T12:34:55.450500+00:00' now(mondays=+1) -- Sets the day to the next Monday which is also '2021-05-10T12:34:55.450500+00:00' now(mondays=-1) -- Sets the day to the previous Monday which is '2021-05-03T12:34:55.450500+00:00' ``` -------------------------------- ### OAuth2 Authorization Request Example Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates the HTTP GET request to the /oauth2/authorize/ endpoint with required and optional query parameters for initiating the OAuth2 authorization flow. The response will redirect users to grant permission for third-party application access to their data. ```http GET /oauth2/authorize/? client_id=123456789& redirect_uri=https://example.com& response_type=code& state=ilovedata& scope=all HTTP/1.1 ``` -------------------------------- ### GET /catalog/datasets/{dataset_id}/exports Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Lists available export formats for a given dataset. The portal provides example datasets. ```APIDOC ## GET /catalog/datasets/{dataset_id}/exports ### Description Lists available export formats for a given dataset. The portal provides example datasets. ### Method GET ### Endpoint /catalog/datasets/{dataset_id}/exports ### Parameters #### Path Parameters - **dataset_id** (string) - Required - The identifier of the dataset to be queried. You can find it in the "Information" tab of the dataset page or in the dataset URL, right after `/datasets/`. ### Request Example (No request body for GET request) ### Response #### Success Response (200) - **links** (array) - Links related to the response, including the available export formats. #### Response Example ```json { "links": [ { "href": "http://example.com", "rel": "self" } ] } ``` ``` -------------------------------- ### Example: Numerical Range Grouping Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 This example demonstrates how to use the `range()` function to group a 'population' field into ranges of width 5. The output shows the generated ranges, such as [10, 15[. ```ODSQL RANGE(population, 5) ``` -------------------------------- ### Bearer Token Response Example Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 An example of the JSON response received after successfully converting an authorization grant to a bearer token. It includes the access token, expiration time, token type, state, scope, and a refresh token. ```JSON { "access_token": "9kxoTUYvSxnAiMpv008NBqRiqk5xWt", "expires_in": 3600, "token_type": "Bearer", "state": "ilovedata", "scope": "all", "refresh_token": "jFfDUcsK9zzNMs1zwczzJxGrimPtmf" } ``` -------------------------------- ### Example: Date Range Grouping Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 This example illustrates using `range()` to group a 'date' field by daily intervals. It shows how the API creates date-based groups, for instance, [2020-01-01T00:00:00.000Z, 2020-01-02T00:00:00.000Z[, and omits days with no data. ```ODSQL RANGE(date, 1 day) ``` -------------------------------- ### GET /catalog/datasets/{dataset_id}/records Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves records from a specific dataset. The portal provides example datasets. ```APIDOC ## GET /catalog/datasets/{dataset_id}/records ### Description Retrieves records from a specific dataset. The portal provides example datasets. ### Method GET ### Endpoint /catalog/datasets/{dataset_id}/records ### Parameters #### Path Parameters - **dataset_id** (string) - Required - The identifier of the dataset to be queried. You can find it in the "Information" tab of the dataset page or in the dataset URL, right after `/datasets/`. ### Request Example (No request body for GET request) ### Response #### Success Response (200) - **total_count** (integer) - The total number of records available. - **links** (array) - Links related to the response. - **records** (array) - An array of record objects. - **record** (object) - Contains the actual data for a record. - **id** (string) - The unique identifier for the record. - **timestamp** (string) - The timestamp of when the record was last updated. - **size** (integer) - The size of the record data. - **fields** (object) - Contains the fields and their values for the record. #### Response Example ```json { "total_count": 137611, "links": [], "records": [ { "links": [], "record": { "id": "53d4524dcb82c676bacd467cd5ace953f2e0389c", "timestamp": "2021-06-22T08:02:59.954Z", "size": 194, "fields": { "admin1_code": "27", "elevation": null, "name": "Saint-Leu", "modification_date": "2019-03-26", "alternate_names": [ "Saint-Leu" ], "feature_class": "P", "admin3_code": "711", "cou_name_en": "France", "coordinates": { "lat": 46.7306, "lon": 4.50083 }, "country_code_2": null, "geoname_id": "2978771", "feature_code": "PPL", "label_en": "France", "dem": 366, "country_code": "FR", "ascii_name": "Saint-Leu", "timezone": "Europe/Paris", "admin2_code": "71", "admin4_code": "71436", "population": 29278 } } } ] } ``` ``` -------------------------------- ### ODSQL Geometry Literal Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Illustrates geometry literals in ODSQL, defined using the `geom` keyword followed by a geometry expression in single quotes. It supports WKT/WKB and GeoJSON geometry formats and shows examples with functions like `distance`. ```ODSQL distance(my_geo_field, geom'POINT(1 1)', 10km) geometry(my_geo_field, geom'{"type": "Polygon","coordinates":[[[100.0, 0.0],[101.0, 0.0],[101.0, 1.0],[100.0, 1.0],[100.0,0.0]]]}') ``` -------------------------------- ### GET /datasets Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves a list of available datasets. This endpoint allows users to discover datasets and their metadata. ```APIDOC ## GET /datasets ### Description Retrieves a list of available datasets. This endpoint allows users to discover datasets and their metadata. ### Method GET ### Endpoint /datasets ### Parameters #### Query Parameters - **rows** (integer) - Optional - Number of datasets to return per page. - **start** (integer) - Optional - Starting index for pagination. ### Request Example ```json { "example": "GET /datasets?rows=10&start=0" } ``` ### Response #### Success Response (200) - **total_count** (integer) - The total number of datasets available. - **links** (array) - Links related to the dataset list (e.g., pagination links). - **datasets** (array) - An array of dataset objects, each containing: - **dataset_id** (string) - The unique identifier for the dataset. - **dataset_uid** (string) - The unique UID for the dataset. - **attachments** (array) - List of attachments for the dataset. - **has_records** (boolean) - Indicates if the dataset has records. - **data_visible** (boolean) - Indicates if the data is visible. - **fields** (array) - An array of field objects describing the dataset's schema. - **metas** (object) - Metadata associated with the dataset, including: - **default** (object) - Default metadata properties like record count, modification dates, source information, keywords, geographic reference, title, description, publisher, license, etc. - **features** (array) - Features supported by the dataset (e.g., "analyze", "geo"). #### Response Example ```json { "total_count": 19, "links": [], "datasets": [ { "links": [], "dataset": { "dataset_id": "world-administrative-boundaries-countries-and-territories", "dataset_uid": "da_6kvv9v", "attachments": [], "has_records": true, "data_visible": true, "fields": [ { "name": "geo_point_2d", "label": "Geo Point", "type": "geo_point_2d" }, { "name": "geo_shape", "label": "Geo Shape", "type": "geo_shape" }, { "name": "status", "label": "Status", "type": "text" }, { "name": "color_code", "label": "ISO 3 country code", "type": "text", "description": "ISO 3 code of the country to which the territory belongs" }, { "name": "region", "label": "Region of the territory", "type": "text" }, { "name": "iso3", "label": "ISO 3 territory code", "type": "text" }, { "name": "continent", "label": "Continent of the territory", "type": "text" }, { "name": "name", "label": "English Name", "type": "text", "description": "Name of the territory" }, { "name": "iso_3166_1_alpha_2_codes", "label": "ISO 3166-1 Alpha 2-Codes", "type": "text" }, { "name": "french_short", "label": "French Name", "type": "text", "description": "French term, when it is available in https://data.opendatasoft.com/explore/dataset/countries-territories-taxonomy-mvp-ct-taxonomy-with-hxl-tags1@public/table/, English name otherwise" } ], "metas": { "default": { "records_count": 256, "modified": "2021-06-23T14:59:57+00:00", "keyword": [ "United Nation", "ISO-3 code", "Countries", "Territories", "Shape", "Boundaries" ], "title": "World Administrative Boundaries - Countries and Territories", "theme": [ "Administration, Government, Public finances, Citizenship" ], "description": "

This dataset displays level 0 world administrative boundaries. It contains countries as well as non-sovereign territories (like, for instance, French overseas).

", "publisher": "World Food Programme (UN agency)", "language": "en", "license": "Open Government Licence v3.0" } }, "features": [ "analyze", "geo" ] } } ] } ``` #### Error Responses - **400** - Bad Request: Invalid query parameters. - **429** - Too Many Requests: Rate limit exceeded. ``` -------------------------------- ### Select All Fields in ODSQL Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Example of a select expression in ODSQL to retrieve all fields from a dataset. This is the default behavior if no fields are specified. ```ODSQL * ``` -------------------------------- ### Select Examples for Opendatasoft Query Language (ODSQL) Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates the usage of the 'select' parameter in ODSQL to control which fields are returned. It supports simple field selection, complex expressions with aliasing, and wildcard usage for retrieving all fields. ```text select=size select=size * 2 as bigger_size select=dataset_id, fields ``` -------------------------------- ### Timezone Parameter Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates setting the 'timezone' parameter for accurate interpretation of datetime fields. It accepts standard timezone IDs, ensuring consistent data handling across different regions. ```text timezone=UTC timezone=Europe/Paris timezone=US/Eastern ``` -------------------------------- ### GET /catalog/exports/{format} Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Exports a catalog in the desired format. Requires an API key for authorization. The 'format' parameter is a path parameter specifying the desired export format. ```APIDOC ## Export a catalog ### Description Export a catalog in the desired format. ### Method GET ### Endpoint /catalog/exports/{format} ### Parameters #### Path Parameters - **format** (string) - Required - Enum: "csv", "data.json", "dcat", "dcat_ap_ch", "dcat_ap_de", "dcat_ap_se", "dcat_ap_sp", "dcat_ap_it", "dcat_ap_vl", "dcat_ap_benap", "dublin_core", "json", "rdf", "rss", "ttl", "xls" - Format specifier for the catalog export. `dcat_ap_*` formats are only available upon activation. See here to get the list of available export formats. ### Request Example None ### Response #### Success Response (200) - The response will be the catalog data in the specified format (e.g., CSV, JSON, etc.). #### Response Example (Response content varies based on the selected format. Example for JSON format): ```json { "links": [ { "href": "http://example.com/catalog/exports/json", "rel": "self" } ] } ``` #### Error Responses - **400** Bad Request - **401** Unauthorized - **429** Too many requests - **500** Internal Server Error ``` -------------------------------- ### GET /catalog/datasets Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves a list of available datasets from the portal. This endpoint supports various query parameters for filtering, sorting, and pagination. ```APIDOC ## GET /catalog/datasets ### Description Retrieves a list of available datasets from the portal. This endpoint supports various query parameters for filtering, sorting, and pagination. ### Method GET ### Endpoint /catalog/datasets ### Parameters #### Query Parameters - **select** (string) - Optional - Used to specify which fields to return. Supports wildcards, field names, include/exclude functions, and complex expressions with labels. - **where** (string) - Optional - A text expression for filtering results, supporting Opendatasoft Query Language (ODSQL) for complex searches. - **order_by** (string) - Optional - A comma-separated list of fields or aggregations to sort by, with optional `asc` or `desc` order. - **limit** (integer) - Optional - The number of items to return. Maximum values depend on the presence of a `group_by` clause. Default is 10. - **offset** (integer) - Optional - The index of the first item to return, starting at 0. Used with `limit` for pagination. - **refine** (string) - Optional - Refines the result set by filtering on a specific facet value. Syntax: `:`. - **exclude** (string) - Optional - Excludes a specific facet value from the result set. Syntax: `:`. - **lang** (string) - Optional - Specifies the language for string formatting. Enum: "en", "fr", "nl", "pt", "it", "ar", "de", "es", "ca", "eu", "sv". Defaults to "fr". - **timezone** (string) - Optional - Sets the timezone for datetime fields. Examples: "UTC", "Europe/Paris". Defaults to "UTC". ### Request Example ``` GET /catalog/datasets?select=dataset_id,name&limit=10&refine=city:Paris ``` ### Response #### Success Response (200) A list of available datasets. - **datasets** (array) - An array of dataset objects. - **dataset_id** (string) - The unique identifier for the dataset. - **name** (string) - The name of the dataset. - ... (other dataset fields) #### Response Example ```json { "datasets": [ { "dataset_id": "my-dataset-1", "name": "Example Dataset 1", "modified": "2023-10-27T10:00:00Z" }, { "dataset_id": "my-dataset-2", "name": "Another Dataset", "modified": "2023-10-26T15:30:00Z" } ] } ``` #### Error Responses - **400** - Bad Request - **401** - Unauthorized - **429** - Too many requests - **500** - Internal Server Error ``` -------------------------------- ### GET /catalog/exports Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves a list of available export formats for datasets within the catalog. This endpoint is secured by an API key. ```APIDOC ## List export formats ### Description List available export formats. ### Method GET ### Endpoint /catalog/exports ### Parameters No specific parameters are required for this request. ### Request Example None ### Response #### Success Response (200) - **links** (array) - Contains a link to the current resource. - **href** (string) - The URL of the link. - **rel** (string) - The relationship of the link (e.g., "self"). #### Response Example ```json { "links": [ { "href": "http://example.com", "rel": "self" } ] } ``` #### Error Responses - **400** Bad Request - **401** Unauthorized - **429** Too many requests - **500** Internal Server Error ``` -------------------------------- ### Refine Parameter Example Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Illustrates the 'refine' parameter, used to filter results based on a specific facet value. This is analogous to selecting an item in a navigation panel and helps narrow down the dataset to relevant entries. ```text refine=modified:2020 refine=city:London ``` -------------------------------- ### GET /catalog/datasets/{dataset_id}/attachments Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves a list of all available attachments for a given dataset. ```APIDOC ## GET /catalog/datasets/{dataset_id}/attachments ### Description Retrieves a list of all available attachments for a specified dataset. ### Method GET ### Endpoint /catalog/datasets/{dataset_id}/attachments #### Path Parameters * **dataset_id** (string) - Required - The identifier of the dataset to be queried. This can be found in the "Information" tab of the dataset page or in the dataset URL, right after `/datasets/`. ### Responses #### Success Response (200) - **links** (array) - Links related to the response. - **attachments** (array) - A list of attachment objects. - **href** (string) - The URL of the attachment. - **metas** (object) - Metadata about the attachment. - **mime-type** (string) - The MIME type of the attachment. - **title** (string) - The title of the attachment. #### Error Responses - **400** - Bad Request - **401** - Unauthorized - **429** - Too many requests - **500** - Internal Server Error ### Request Example ```json { "links": [], "attachments": [ { "href": "https://documentation-resources.opendatasoft.com/api/v2/catalog/datasets/geonames-all-cities-with-a-population-1000/attachments/cities1000_zip", "metas": { "mime-type": "application/zip", "title": "cities1000.zip" } } ] } ``` ``` -------------------------------- ### List Dataset Facets Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Enumerates facet values for records within a dataset. Useful for implementing guided navigation. Requires an API key for authorization. Returns a list of values for each facet. ```http GET /catalog/datasets/{dataset_id}/facets HTTP/1.1 Host: documentation-resources.huwise.com Authorization: Apikey YOUR_API_KEY ``` -------------------------------- ### GET /catalog/datasets/{dataset_id} Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Returns a list of available endpoints for the specified dataset, with metadata and endpoints. The response includes links to the attachments, files, records, and catalog endpoints. ```APIDOC ## GET /catalog/datasets/{dataset_id} ### Description Returns a list of available endpoints for the specified dataset, with metadata and endpoints. The response includes links to the attachments endpoint, the files endpoint, the records endpoint, and the catalog endpoint. ### Method GET ### Endpoint `/catalog/datasets/{dataset_id}` ### Authorization - **apikey** - Required - API key authentication ### Parameters #### Path Parameters - **dataset_id** (string) - Required - The identifier of the dataset to be queried. You can find it in the "Information" tab of the dataset page or in the dataset URL, right after `/datasets/`. #### Query Parameters - **select** (string) - Optional - A select expression to add, remove or change the fields to return. Can be a wildcard ('*'), a field name, an include/exclude function, or a complex expression with optional label. - Example: `select=size` - Example: `select=size * 2 as bigger_size` - Example: `select=dataset_id, fields` - **lang** (string) - Optional - Enum: "en", "fr", "nl", "pt", "it", "ar", "de", "es", "ca", "eu", "sv" - A language value. If specified, the lang value overrides the default language, which is "fr". The language is used to format strings, for example in the date_format function. - **timezone** (string) - Optional - Default: "UTC" - Set the timezone for datetime fields. Timezone IDs are defined by the Unicode CLDR project. - Example: `timezone=UTC` - Example: `timezone=Europe/Paris` - Example: `timezone=US/Eastern` - Example: `timezone=Europe/London` - Example: `timezone=Europe/Berlin` ### Response #### Success Response (200) The dataset information with available endpoints and metadata. #### Error Responses - **400** - Bad Request - **401** - Unauthorized - **429** - Too many requests - **500** - Internal Server Error ### Base URL `https://documentation-resources.huwise.com/api/explore/v2.0` ``` -------------------------------- ### List Dataset Facets Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Enumerates facet values for records and returns a list of values for each facet. This can be used to implement guided navigation in large result sets. ```APIDOC ## GET /catalog/datasets/{dataset_id}/facets ### Description Enumerates facet values for records and returns a list of values for each facet. This can be used to implement guided navigation in large result sets. ### Method GET ### Endpoint /catalog/datasets/{dataset_id}/facets ### Parameters #### Path Parameters - **dataset_id** (string) - Required - The identifier of the dataset to be queried. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) Returns a list of facet values for the specified dataset. #### Error Responses - **400** Bad Request - **401** Unauthorized - **429** Too many requests - **500** Internal Server Error ``` -------------------------------- ### GET /catalog/datasets/{dataset_id}/exports/gpx Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Exports a specified dataset in GPX format. You can specify fields for name and description, and control the use of extension tags. ```APIDOC ## GET /catalog/datasets/{dataset_id}/exports/gpx ### Description Exports a specified dataset in GPX format. You can specify fields for name and description, and control the use of extension tags. ### Method GET ### Endpoint /catalog/datasets/{dataset_id}/exports/gpx ### Parameters #### Path Parameters - **dataset_id** (string) - Required - The identifier of the dataset to be queried. #### Query Parameters - **name_field** (string) - Optional - Sets the field that is used as the 'name' attribute in the GPX output. - **description_field_list** (string) - Optional - Sets the fields to use in the 'description' attribute of the GPX output. - **use_extension** (boolean) - Optional - Set it to true to use the `` tag for attributes. Set it to false to use the `` tag for attributes. Default: false ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) Return a file #### Error Responses - **400** Bad Request - **401** Unauthorized - **429** Too many requests - **500** Internal Server Error #### Response Example (400) ```json { "message": "ODSQL query is malformed: invalid_function() Clause(s) containing the error(s): select.", "error_code": "ODSQLError" } ``` ``` -------------------------------- ### GET /catalog/exports/{format} Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Exports catalog data in a specified format (e.g., CSV). Supports filtering, sorting, pagination, and field selection. ```APIDOC ## GET /catalog/exports/{format} ### Description Exports catalog data in a specified format. This endpoint allows for advanced querying using parameters like `select`, `where`, `order_by`, `limit`, `offset`, `refine`, `exclude`, `lang`, and `timezone`. ### Method GET ### Endpoint `/catalog/exports/{format}` ### Parameters #### Path Parameters - **format** (string) - Required - The format of the export (e.g., `csv`). #### Query Parameters - **select** (string) - Optional - Specifies which fields to return. Can include field names, wildcard (`*`), include/exclude functions, or complex expressions with labels. * Example: `select=size` * Example: `select=size * 2 as bigger_size` * Example: `select=dataset_id, fields` - **where** (string) - Optional - A text expression for filtering results, supporting Opendatasoft Query Language (ODSQL) for complex searches. - **order_by** (string) - Optional - A comma-separated list of field names or aggregations to sort on, with optional `asc` (default) or `desc` order. * Example: `order_by=sum(age) desc, name asc` - **limit** (integer) - Optional - The maximum number of items to return. Defaults to -1 (all records). - **offset** (integer) - Optional - The index of the first item to return (starting at 0). Used with `limit` for pagination. - **refine** (string) - Optional - A facet filter to limit the result set. Syntax: `:`. * Example: `refine=modified:2020` - **exclude** (string) - Optional - A facet filter to exclude a facet value from the result set. Syntax: `:`. * Example: `exclude=city:Paris` - **lang** (string) - Optional - Specifies the language for formatting string fields. Enum: `en`, `fr`, `nl`, `pt`, `it`, `ar`, `de`, `es`, `ca`, `eu`, `sv`. Defaults to `fr`. - **timezone** (string) - Optional - Sets the timezone for datetime fields. Defaults to `UTC`. * Example: `timezone=Europe/Paris` ### Request Example (No specific request body for GET requests, parameters are in the URL) ### Response #### Success Response (200) Returns a file in the specified format (e.g., CSV). #### Error Responses - **400** Bad Request - **401** Unauthorized - **429** Too many requests - **500** Internal Server Error #### Response Example (400 Bad Request) ```json { "message": "ODSQL query is malformed: invalid_function() Clause(s) containing the error(s): select.", "error_code": "ODSQLError" } ``` ``` -------------------------------- ### GET /api/explore/v2.0/exports Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Provides access to dataset exports without limitations on the number of records returned. This endpoint also uses Opendatasoft Query Language (ODSQL). ```APIDOC ## GET /api/explore/v2.0/exports ### Description Retrieves data exports from a dataset. Unlike the `records` endpoint, this endpoint has no limitations on the number of records returned. It supports Opendatasoft Query Language (ODSQL). ### Method GET ### Endpoint `https:///api/explore/v2.0//exports` ### Parameters #### Query Parameters - **[ODSQL_parameters]** (string) - Optional - Any valid Opendatasoft Query Language parameter for filtering or sorting data. ### Request Example ``` GET https://documentation-resources.huwise.com/explore/gold-prices/exports?limit=1000 ``` ### Response #### Success Response (200) - The response format depends on the requested export format (e.g., CSV, JSON). #### Response Example (JSON) ```json [ { "date": "2023-10-26", "price": 1980.50 }, { "date": "2023-10-25", "price": 1975.20 } // ... potentially many more records ] ``` ``` -------------------------------- ### List Facet Values API Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Enumerate facet values for datasets and returns a list of values for each facet. This can be used to implement guided navigation in large result sets. ```APIDOC ## List facet values ### Description Enumerate facet values for datasets and returns a list of values for each facet. Can be used to implement guided navigation in large result sets. ### Method GET ### Endpoint /list/facet/values (Note: Actual endpoint path not fully specified in the provided text) ### Parameters (Parameters for this endpoint were not detailed in the provided text) ### Responses (Response details for this endpoint were not detailed in the provided text) ``` -------------------------------- ### ODSQL Field Name Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates valid field names in ODSQL, including regular alphanumeric names, fields containing only numbers, and keywords that require backticks. It highlights the use of backticks to differentiate between field names and numeric literals or keywords. ```ODSQL my_field > 10 -- my_field is a field name `12` > 10 -- without back quotes, 12 would be considered a numeric literal `and`: "value" -- AND is a keyword, `and` represents a field name then ``` -------------------------------- ### List Facet Values API Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 This API endpoint enumerates facet values for datasets, providing a list of values for each facet. It's useful for implementing guided navigation within large datasets and requires API key authorization. ```API GET /facet_values ``` -------------------------------- ### GET /api/explore/v2.0/records Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves records from a dataset. This endpoint supports Opendatasoft Query Language (ODSQL) for filtering and pagination. The `limit` parameter specifies the number of records per page, and `offset` specifies the page number. ```APIDOC ## GET /api/explore/v2.0/records ### Description Retrieves records from a specified dataset. This endpoint utilizes the Opendatasoft Query Language (ODSQL) and supports pagination via `limit` and `offset` parameters. ### Method GET ### Endpoint `https:///api/explore/v2.0//records` ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of records to return per page. Defaults to a system-defined value. - **offset** (integer) - Optional - The number of records to skip. Defaults to 0. - **[ODSQL_parameters]** (string) - Optional - Any valid Opendatasoft Query Language parameter for filtering or sorting data. ### Request Example ``` GET https://documentation-resources.huwise.com/explore/gold-prices/records?limit=2&offset=0 ``` ### Response #### Success Response (200) - **links** (array) - A list of links for navigation. - **records** (array) - A list of data records matching the query. #### Response Example ```json { "links": [ { "href": "https://documentation-resources.huwise.com/explore/gold-prices/records?limit=2&offset=0", "rel": "self" }, { "href": "https://documentation-resources.huwise.com/explore/gold-prices/records?limit=2&offset=2", "rel": "next" } ], "records": [ { "datasetid": "gold-prices", "fields": { "date": "2023-10-26", "price": 1980.50 }, "recordid": "1", "timestamp": "2023-10-26T10:00:00Z" }, { "datasetid": "gold-prices", "fields": { "date": "2023-10-25", "price": 1975.20 }, "recordid": "2", "timestamp": "2023-10-25T10:00:00Z" } ] } ``` ``` -------------------------------- ### Boolean Operators in ODS Explore v2 Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates the use of AND, OR, and NOT boolean operators to filter data. It shows how precedence can be managed with parentheses. The examples illustrate filtering based on boolean fields, numeric comparisons, and date comparisons. ```sql my_boolean_field OR my_numeric_field > 50 and my_date_field > date'1972' -- Results can have my_boolean_field to true. They can also have my_numeric_field greater than 50 and my_date_field older than 1972 (my_boolean_field OR my_numeric_field > 50) and my_date_field > date'1972' -- Results must have my_date_field older than 1972. They also must have my_boolean_field to true or my_numeric_field greater than 50 ``` -------------------------------- ### Facet Parameter Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Demonstrates various ways to use the 'facet' parameter, including basic field selection and the advanced 'facet()' function with options like disjunctive, hierarchical, separator, sort, and limit. This helps in customizing facet retrieval for data exploration. ```text facet=field_name facet=facet(name="field_name") facet=facet(name="filepath", hierarchical=true, separator="/") facet=facet(name="modified", sort="-alphanum", limit=10) ``` -------------------------------- ### Export Dataset to GPX Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Exports a dataset in GPX format. Allows specifying fields for name and description attributes, and controlling the use of extension tags. Requires an API key for authorization. Returns a file on success or an error response. ```http GET /catalog/datasets/{dataset_id}/exports/gpx?name_field=name&description_field_list=description1,description2&use_extension=true HTTP/1.1 Host: documentation-resources.huwise.com Authorization: Apikey YOUR_API_KEY ``` -------------------------------- ### ODSQL Numeric Literal Examples Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Provides examples of numeric literals in ODSQL, which include both integers and decimal values. These literals are not enclosed in quotes and can be used in comparisons and expressions. ```ODSQL 100 5.8 my_field > 108.7 ``` -------------------------------- ### Export Dataset to Parquet Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Exports a dataset in Parquet format with specified compression. Requires an API key for authorization. Supports 'snappy' and 'zstd' compression. Returns a file on success or an error response. ```http GET /catalog/datasets/{dataset_id}/exports/parquet?parquet_compression=zstd HTTP/1.1 Host: documentation-resources.huwise.com Authorization: Apikey YOUR_API_KEY ``` -------------------------------- ### Catalog Facets API Response Sample Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Provides a sample JSON response for the /catalog/facets endpoint. It shows the structure for 'links' and 'facets', where each facet includes its name, count, state, and value. ```json { "links": [ ], "facets": [ { "name": "publisher", "facets": [ { "count": 2, "state": "displayed", "name": "Opendatasoft", "value": "Opendatasoft" }, { "count": 2, "state": "displayed", "name": "Opendatasoft - Data Team", "value": "Opendatasoft - Data Team" } ] }, { "name": "features", "facets": [ { "count": 19, "state": "displayed", "name": "analyze", "value": "analyze" }, { "count": 13, "state": "displayed", "name": "timeserie", "value": "timeserie" } ] }, { "name": "language", "facets": [ { "count": 17, "state": "displayed", "name": "en", "value": "en" }, { "count": 4, "state": "displayed", "name": "fr", "value": "fr" } ] } ] } ``` -------------------------------- ### GET /api/explore/v2.0/catalog/datasets/gold-prices/records Source: https://help.opendatasoft.com/apis/ods-explore-v2/explore_v2 Retrieves records from the gold-prices dataset. This endpoint supports query parameters for filtering and pagination. ```APIDOC ## GET /api/explore/v2.0/catalog/datasets/gold-prices/records ### Description Retrieves records of the `gold-prices` dataset from the `documentation-resources.huwise.com` domain. This endpoint allows for custom queries to select and group data, and supports pagination. ### Method GET ### Endpoint `https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records` ### Parameters #### Query Parameters - **select** (string) - Optional - The Opendatasoft Query Language (ODSQL) clause for selecting fields and aggregations. - **group_by** (string) - Optional - The Opendatasoft Query Language (ODSQL) clause for grouping results. - **limit** (integer) - Optional - The maximum number of records to return per page. Defaults to 2 in the example. - **offset** (integer) - Optional - The number of records to skip for pagination. ### Request Example ```bash curl -X GET "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records?limit=2&select=count(*)&group_by=year(date)" ``` ### Response #### Success Response (200) - **total_count** (integer) - The total number of records available for the query. - **links** (array) - Contains pagination and self-referential links. - **href** (string) - The URL for the link. - **rel** (string) - The relationship of the link (e.g., "self", "next", "last"). - **records** (array) - An array of data records. - **links** (array) - Links specific to each record. - **record** (object) - The data payload for a single record. - **id** (string) - Unique identifier for the record. - **timestamp** (string) - The creation timestamp of the record. - **size** (integer) - The size of the record data. - **fields** (object) - The actual data fields of the record (e.g., `date`, `price`). #### Response Example ```json { "total_count": 384, "links": [ { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records?limit=2&offset=0", "rel": "self" }, { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records?limit=2&offset=0", "rel": "first" }, { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records?limit=2&offset=382", "rel": "last" }, { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records?limit=2&offset=2", "rel": "next" } ], "records": [ { "links": [ { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices/records/d4ebc8ae60807315d74a9a0fa481ef2da8d39d0b", "rel": "self" }, { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets/gold-prices", "rel": "dataset" }, { "href": "https://documentation-resources.huwise.com/api/explore/v2.0/catalog/datasets", "rel": "datasets" } ], "record": { "id": "d4ebc8ae60807315d74a9a0fa481ef2da8d39d0b", "timestamp": "2021-01-04T10:28:49.111Z", "size": 19, "fields": { "date": "1988-01", "price": 477.758 } } } ] } ``` ```