Get data (Pivot API)

This endpoint returns dataset's data in pivot table format.

Input

The input data should specify dataset id and pivot header/stub/filter components. For header/stub it should be arrays of header/stub items where dimension field is mandatory and members field is optional. If no members specified in header/stub item it means all dimension members should be included in the request. Filter request should be array of filter items. Each filter item should have dimension and members field. Only single member can be specified for filter item. The dimension cannot be included into header/stub/filter at the same time.

Result

The output of this endpoint is array of tuples. For each header/stub dimension there will be corresponding tuple field and also value field. Stub fields will be included in the order of their definition in request followed by header fields in the order of their definition in request. Tuples will follow the value order defined in request, i.e. tuples for values listed first will be followed by tuples for values listed later.

Name Type Description
Dataset string Unique dataset id
Header object Dimension details and members of header
Contains array of
  • Dimension: Dimension id
  • Members: Distinct sorted values of dimension members
Stub Object Dimension details and members of stub
Contains array of
  • Dimension: Dimension id
  • Members: Distinct sorted values of dimension members
Filter ObjectDimension details of members which are used as a filter. This can
contain only one member.
DataobjectTuples describing each data point.
consists
  • Time: Date of observation
  • Value : contains the significand/mantissa of observation value.
    Should be multiplied with scale for observation data.
  • Unit: Unit associated with value
  • Scale: Value's multiplication factor.
  • Frequency: Interval of time between which observation data is recorded. Values can be 'A' -Annual ,'Q' -Quarterly, 'M' -Monthly ,'W' -Weekly

Example

Post: http://data.gov.om/api/1.0/data/pivot
{
   "Header": [
      {
         "DimensionId": "Time",
         "Members": [
            {
               "Key": "-318",
               "Name": "AvgA(2002,2012)",
               "Formula": [
                  "2002",
                  "2012",
                  "avga"
               ]
            },
            "2002",
            "2012"
         ],
         "DimensionName": "Time",
         "UiMode": "individualMembers"
      }
   ],
   "Stub": [
      {
         "DimensionId": "indicator",
         "Members": [
            "1000010"
         ],
         "DimensionName": "Indicators"
      },
      {
         "DimensionId": "periodic-release",
         "Members": [
            "1000000"
         ],
         "DimensionName": "Periodic release"
      },
      {
         "DimensionId": "program-quality",
         "Members": [
            "1000000"
         ],
         "DimensionName": "Program quality"
      }
   ],
   "Filter": [
      {
         "DimensionId": "region",
         "Members": [
            "1000000"
         ],
         "DimensionName": "Regions"
      }
   ],
   "Frequencies": [
      "A"
   ],
   "FoldDimension": null,
   "Dataset": "OMINF2016"
}
 
Result
{
   "header":[
      {
         "dimensionId":"Time",
         "filterText":null,
         "members":[
            "AvgA(2002,2012)",
            "2002",
            "2012"
         ],
         "metadataFields":[
 
         ]
      }
   ],
   "stub":[
      {
         "dimensionId":"indicator",
         "filterText":null,
         "members":[
            "Grand Total - Transmission & Broadcasting Hours :Daily - No"
         ],
         "metadataFields":[
 
         ]
      },
      {
         "dimensionId":"periodic-release",
         "filterText":null,
         "members":[
            "Total"
         ],
         "metadataFields":[
 
         ]
      },
      {
         "dimensionId":"program-quality",
         "filterText":null,
         "members":[
            "Total"
         ],
         "metadataFields":[
 
         ]
      }
   ],
   "filter":[
      {
         "dimensionId":"region",
         "filterText":null,
         "members":[
            "Oman"
         ],
         "metadataFields":[
 
         ]
      }
   ],
   "datasetName":"Information",
   "dataset":"OMINF2016",
   "keys":{
      "header":[
         {
            "dimensionId":"Time",
            "filterText":null,
            "members":[
               "-318",
               "2002",
               "2012"
            ],
            "metadataFields":[
 
            ]
         }
      ],
      "stub":[
         {
            "dimensionId":"indicator",
            "filterText":null,
            "members":[
               "1000010"
            ],
            "metadataFields":[
 
            ]
         },
         {
            "dimensionId":"periodic-release",
            "filterText":null,
            "members":[
               "1000000"
            ],
            "metadataFields":[
 
            ]
         },
         {
            "dimensionId":"program-quality",
            "filterText":null,
            "members":[
               "1000000"
            ],
            "metadataFields":[
 
            ]
         }
      ],
      "filter":[
         {
            "dimensionId":"region",
            "filterText":null,
            "members":[
               "1000000"
            ],
            "metadataFields":[
 
            ]
         }
      ]
   },
   "data":[
      {
         "Time":"AvgA(2002,2012)",
         "program-quality":"Total",
         "periodic-release":"Total",
         "indicator":"Grand Total - Transmission & Broadcasting Hours :Daily - No",
         "region":"Oman",
         "RegionId":"OM",
         "Frequency":"",
         "Value":104.727272727273,
         "Unit":"",
         "Scale":1
      },
      {
         "Time":"2002-01-01T00:00:00Z",
         "program-quality":"Total",
         "periodic-release":"Total",
         "indicator":"Grand Total - Transmission & Broadcasting Hours :Daily - No",
         "region":"Oman",
         "RegionId":"OM",
         "Frequency":"A",
         "Value":65,
         "Unit":"Number",
         "Scale":1
      },
      {
         "Time":"2012-01-01T00:00:00Z",
         "program-quality":"Total",
         "periodic-release":"Total",
         "indicator":"Grand Total - Transmission & Broadcasting Hours :Daily - No",
         "region":"Oman",
         "RegionId":"OM",
         "Frequency":"A",
         "Value":140,
         "Unit":"Number",
         "Scale":1
      }
   ]
}