Skip to content

API Cube

damiancosmoschapman edited this page May 22, 2024 · 50 revisions

Home / API / Cube JSON-RPC

This page contains the JSON-RPC versions of the Cube methods. For the RESTful methods, please go to the RESTful page for Cube.

ReadCollection.

Returns a shorter Collection of JsonStat items. Please refer to JSON-stat documentation for a full explanation of the structure: https://json-stat.org/format/.

Authentication: Anonymous

Privilege : N/A

Method: PxStat.Data.Cube_API.ReadCollection

Parameters:

Name Type Default Description
language String null or empty ISO Language Code
datefrom Date ('YYYY-MM-DD') null or empty Date from details

Return: json

The Json format follows the JSON-Stat schema. Please refer to the JSON-stat documentation. An example (containing just one dataset) is shown below:

{

    "jsonrpc": "2.0",
    "result": {
        "class": "collection",
        "link": {
            "item": [
                {
                    "extension": {
                        "copyright": {
                            "name": "Central Statistics Office, Ireland",
                            "code": "CSO",
                            "href": "https://www.cso.ie"
                        },
                        "exceptional": false,
                        "language": {
                            "code": "en",
                            "name": "English"
                        },
                        "matrix": "TEM17"
                    },
                    "href": "https://dev-ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM17/JSON-stat/2.0/en",
                    "label": "Motor Cycles Licensed for the First Time",
                    "link": {
                        "alternate": [
                            {
                                "type": "text/csv",
                                "href": "https://dev-ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM17/CSV/1.0/en"
                            },
                            {
                                "type": "application/json",
                                "href": "https://dev-ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM17/JSON-stat/1.0/en"
                            },
                            {
                                "type": "text/plain",
                                "href": "https://dev-ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM17/PX/2013/en"
                            },
                            {
                                "type": "application/base64",
                                "href": "https://dev-ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM17/XLSX/2007/en"
                            }
                        ]
                    },
                    "updated": "2020-11-20T11:00:00.000Z"
                               }
            ]
        },
        "version": "2.0"
    }
}

ReadDataset.

Reads a live dataset based on specific criteria. Please refer to JSON-stat documentation for a full explanation of the structure: https://json-stat.org/format/.

Authentication: Anonymous

Privilege : N/A

Method: PxStat.Data.Cube_API.ReadDataset

Parameters:

Parameters must conform to the JSON-stat query schema. See query schema Additionally PxStat requires the following structure in the extension object:

Name Type Default Description
matrix string matrix code of the dataset being queried
language Object Preferred language and culture of returned data. See language object below
format Object Format of returned data. See format object below

Language:

Name Type Default Description
code string ISO Language code
culture string null culture code e.g. en-IE

Format:

Name Type Default Description
type string e.g. PX, JSON-stat, XLSX, CSV
version string version of the type

An example request call with the parameter:

{
	"jsonrpc": "2.0",
	"method": "PxStat.Data.Cube_API.ReadDataset",
	"params": {
  "class": "query",
  "id": [ "STATISTIC", "TLIST(A1)", "C02199V02655", "C02466V02984" ],
  "dimension": {
    "STATISTIC": {
      "category": {
        "index": [ "752c208d80db697b2dc8fd2463a0c137" ]
      }
    },
    "TLIST(A1)": {
      "category": {
        "index": [ "2047", "2048", "2049", "2050", "2051" ]
      }
    },
    "C02199V02655": {
      "category": {
        "index": [ "1", "2" ]
      }
    },
    "C02466V02984": {
      "category": {
        "index": [ "03", "04", "05" ]
      }
    }
  },
  "extension": {
    "matrix": "LIAMTESTPEC18",
    "language": {
      "code": "en",
      "culture": "fr-CH"
    },
    "format": {
      "type": "XLSX",
      "version": "2007"
    },
    "codes": true
  },
  "version": "2.0"
}
}

Return: Data in format: JSON-stat or PX or csv or xlsx depending on the chosen format input parameter.


ReadMetadata.

Reads the metadata for a live dataset based on specific criteria. Please refer to JSON-stat documentation for a full explanation of the structure: https://json-stat.org/format/.

Authentication: Anonymous

Privilege : N/A

Method: PxStat.Data.Cube_API.ReadMetadata

Parameters:

Name Type Default Description
matrix String Matrix Code
release Int null Release Number
format format object null (see below)
language String en* LngIsoCode e.g. "en"
role JSON-stat role null See JSON-stat documentation
dimension JSON-stat dimension null See JSON-stat documentation
m2m boolean true m2m

Format object:

Name Type Default Description
type String JSON-stat* JSON-stat or PX or csv
version String x.y Version of the format, e.g 2.0
*This default may vary depending on API configuration

An example request call with the parameter:

{
    "jsonrpc": "2.0",
    "method": "PxStat.Data.Cube_API.ReadMetadata",
    "params": {
       "matrix": "CPA05",
       "format": {
       "type": "JSON-stat",
       "version": "2.0"
      },
       "language": "en",
       "m2m": false
},
    "id": "2"
}

Return: Metadata in JSON-stat format.


ReadPreDataset.

Reads any Dataset (including pre-release data) based on Release Code and other criteria. Please refer to JSON-stat documentation for a full explanation of the structure: https://json-stat.org/format/.

Authentication: Windows

Privilege : N/A

Method: PxStat.Data.Cube_API.ReadPreDataset

Parameters:

Parameters must conform to the JSON-stat query schema. See query schema Additionally PxStat requires the following structure in the extension object.

Name Type Default Description
release string Release code of the dataset being queried
language Object Preferred language and culture of returned data. See language object below
format Object Format of returned data. See format object below

Language:

Name Type Default Description
code string ISO Language code
culture string null culture code e.g. en-IE

Format:

Name Type Default Description
type string e.g. PX, JSON-stat, XLSX, CSV
version string version of the type

An example request call with the parameter:

{
"jsonrpc": "2.0",
	"method": "PxStat.Data.Cube_API.ReadPreDataset",
	"params": {
  "class": "query",
"id": [ "STATISTIC", "TLIST(A1)", "C02484V03007", "C02199V02655" ],
  "dimension": {
    
    "TLIST(A1)": {
      "category": {
        "index": [
          "2018",
          "2017",
          "2016"
        ]
      }
    },
    "C02484V03007": {
      "category": {
        "index": [
          "01",
          "02",
          "03"
        ]
      }
    },
    "C02199V02655": {
      "category": {
        "index": [ "1",
          "2" ]
      }
    }
  },
  "extension": {
    "release": "79",
    "language": {
      "code": "en",
      "culture": "fr-CH"
    },
    "format": {
      "type": "XLSX",
      "version": "2007"
    },
    "codes": false
  },
  "version": "2.0"
}
}

Return: Data in format: JSON-stat or PX or csv or xlsx depending on the chosen format input parameter.


ReadPreMetadata.

Reads the metadata for a non live dataset based on Release code and other criteria. Please refer to JSON-stat documentation for a full explanation of the structure: https://json-stat.org/format/.

Authentication: Windows

Privilege : Administrator , Moderator , Power User

Method: PxStat.Data.Cube_API.ReadPreMetadata

Parameters:

Name Type Default Description
matrix String Matrix code
format format object null (see below)
release Int null Release Number
language String en* LngIsoCode e.g. "en"
role JSON-stat role null See JSON-stat documentation
dimension JSON-stat dimension null See JSON-stat documentation
m2m boolean true m2m

Format object:

Name Type Default Description
type String JSON-stat* JSON-stat or PX or csv
version String x.y Version of the format, e.g 2.0

*This default may vary depending on API configuration.

An example request call with the parameter:

{
    "jsonrpc": "2.0",
    "method": "PxStat.Data.Cube_API.ReadPreMetadata",
    "params": {
        "release": "3",
       "format": {
       "type": "JSON-stat",
       "version": "2.0"
      },
       "language": "en",
       "m2m": false
},
    "id": "2"
}

Return: Data in format: JSON-stat.

Clone this wiki locally