Tutorial

In this tutorial we will explore the endpoints necessary fore creating and managing a data set using EconData. First we will need to get an access token to authenticate and authorise our API calls, we will include the access token in the authorization header in subsequent calls. You will need the following

  1. sub_domain
  2. client_id
  3. client_secret
curl 'https://sub_domain.amazoncognito.com/oauth2/token' \
-X POST \
-H 'Host: sub_domain.amazoncognito.com' \
-H 'Connection: keep-alive' \
-H 'Accept: */*' \
-H 'Accept-Language: en-GB,en;q=0.9' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=id&client_secret=secret'

Please email any requests for credentials to econdata@codera.co.za.

We will first create a new data set against the ECONDATA:MINING_ECONDATA_STATSSA(0.0.0) provision agreement. The associated data structure definition that describes the allowable (as we as required) attributes of the data set can be queried by finding the data structures definition linked to this provision agreement.

Create new data set

Here we are creating the data set, no observation data is created (and the observation vector should be left empty).

curl -X 'POST' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets' \
  -H 'accept: application/vnd.sdmx-codera.data+json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'Content-Type: application/vnd.sdmx-codera.data+json' \
  -d '[
  "#sdmx.infomodel.message.SDMXMessage",
  {
    "header": {
      "id": "EconData",
      "prepared": "2025-04-22T07:44:19.612725638",
      "sender": "EconData web application",
      "receiver": "114c82b8-4071-704b-5378-5ce588960e49"
    },
    "data-sets": [
      [
        "#sdmx.infomodel.dataset.DataSet",
        {
          "agencyid": "ECONDATA",
          "id": "MINING",
          "version": "0.0.0",
          "name": [
            "en",
            "Mining test data set"
          ],
          "provision-agreement": [
            "#sdmx.infomodel.registry.ProvisionAgreementRef",
            {
              "agencyid": "ECONDATA",
              "id": "MINING_ECONDATA_STATSSA",
              "version": "0.0.0"
            }
          ],
          "SOURCE_DATASET": "P2041",
          "RELEASE": "Unreleased",
          "series": [
            {
              "series-key": "MIN002.I.N",
              "MNEMONIC": "MIN002",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "FREQ": "M",
              "BASE_PER": "2015",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20001",
              "LABEL": "Total, gold excluded"
              "obs": [],
            },
            {
              "series-key": "MIN001.I.N",
              "MNEMONIC": "MIN001",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "FREQ": "M",
              "BASE_PER": "2015",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20000",
              "LABEL": "Total, gold included"
              "obs": [],
            }
          ]
        }
      ]
    ]
  }
]'

Returns

{
  "success": "Data set successfully created."
}

Stage data

Let us now stage some observation data

curl -X 'POST' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0/stage' \
  -H 'accept: application/vnd.sdmx-codera.data+json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'Content-Type: application/vnd.sdmx-codera.data+json' \
  -d '[
  "#sdmx.infomodel.message.SDMXMessage",
  {
    "header": {
      "id": "EconData",
      "prepared": "2025-04-22T07:44:19.612725638",
      "sender": "EconData web application",
      "receiver": "114c82b8-4071-704b-5378-5ce588960e49"
    },
    "data-sets": [
      [
        "#sdmx.infomodel.dataset.DataSet",
        {
          "agencyid": "ECONDATA",
          "id": "MINING",
          "version": "0.0.0",
          "name": [
            "en",
            "Mining test data set"
          ],
          "provision-agreement": [
            "#sdmx.infomodel.registry.ProvisionAgreementRef",
            {
              "agencyid": "ECONDATA",
              "id": "MINING_ECONDATA_STATSSA",
              "version": "0.0.0"
            }
          ],
          "SOURCE_DATASET": "P2041",
          "RELEASE": "Unreleased",
          "series": [
            {
              "MNEMONIC": "MIN002",
              "obs": [
                {
                  "TIME_PERIOD": "2022-01-01",
                  "OBS_VALUE": 91.0
                },
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 85.1
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN002.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20001",
              "LABEL": "Total, gold excluded"
            },
            {
              "MNEMONIC": "MIN001",
              "obs": [
                {
                  "TIME_PERIOD": "2022-01-01",
                  "OBS_VALUE": 84.2
                },
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 82.1
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN001.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20000",
              "LABEL": "Total, gold included"
            }
          ]
        }
      ]
    ]
  }
]'

Returns

{
  "success": "Data set release successfully staged"
}

Read back staged/unreleased data

curl -X 'GET' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0' \
  -H 'accept: application/vnd.sdmx-codera.data+json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'

Returns

[
  "#sdmx.infomodel.message.SDMXMessage",
  {
    "header": {
      "id": "EconData",
      "prepared": "2025-04-23T12:25:36.414897380",
      "sender": "EconData web application",
      "receiver": "810c2268-2001-703a-5207-457704ed920f"
    },
    "structures": null,
    "data-sets": [
      [
        "#sdmx.infomodel.dataset.DataSet",
        {
          "agencyid": "ECONDATA",
          "id": "MINING",
          "version": "0.0.0",
          "name": [
            "en",
            "Mining test data set"
          ],
          "provision-agreement": [
            "#sdmx.infomodel.registry.ProvisionAgreementRef",
            {
              "agencyid": "ECONDATA",
              "id": "MINING_ECONDATA_STATSSA",
              "version": "0.0.0"
            }
          ],
          "SOURCE_DATASET": "P2041",
          "RELEASE": "Unreleased",
          "series": [
            {
              "MNEMONIC": "MIN001",
              "obs": [
                {
                  "TIME_PERIOD": "2022-01-01",
                  "OBS_VALUE": 84.2
                },
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 82.1
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN001.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20000",
              "LABEL": "Total, gold included"
            },
            {
              "MNEMONIC": "MIN002",
              "obs": [
                {
                  "TIME_PERIOD": "2022-01-01",
                  "OBS_VALUE": 91
                },
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 85.1
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN002.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20001",
              "LABEL": "Total, gold excluded"
            }
          ]
        }
      ]
    ]
  }
]

Commit/release staged data

curl -X 'POST' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0/commit?release=2025-04-23T14%3A27%3A00&description=First%20release' \
  -H 'accept: application/vnd.sdmx-codera.data+json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx' \
  -d ''

Returns

{
  "success": "Data set release successfully committed."
}

Stage update (prepare for second release)

curl -X 'POST' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0/stage' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'Content-Type: application/vnd.sdmx-codera.data+json' \
  -d '[
  "#sdmx.infomodel.message.SDMXMessage",
  {
    "header": {
      "id": "EconData",
      "prepared": "2025-04-22T07:44:19.612725638",
      "sender": "EconData web application",
      "receiver": "114c82b8-4071-704b-5378-5ce588960e49"
    },
    "data-sets": [
      [
        "#sdmx.infomodel.dataset.DataSet",
        {
          "agencyid": "ECONDATA",
          "id": "MINING",
          "version": "0.0.0",
          "name": [
            "en",
            "Mining test data set"
          ],
          "provision-agreement": [
            "#sdmx.infomodel.registry.ProvisionAgreementRef",
            {
              "agencyid": "ECONDATA",
              "id": "MINING_ECONDATA_STATSSA",
              "version": "0.0.0"
            }
          ],
          "SOURCE_DATASET": "P2041",
          "RELEASE": "Unreleased",
          "series": [
            {
              "MNEMONIC": "MIN002",
              "obs": [
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 85.0
                },
                {
                  "TIME_PERIOD": "2022-03-01",
                  "OBS_VALUE": 103.1
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN002.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20001",
              "LABEL": "Total, gold excluded"
            },
            {
              "MNEMONIC": "MIN001",
              "obs": [
                {
                  "TIME_PERIOD": "2022-02-01",
                  "OBS_VALUE": 80.0
                },
                {
                  "TIME_PERIOD": "2022-03-01",
                  "OBS_VALUE": 94.7
                }
              ],
              "FREQ": "M",
              "BASE_PER": "2015",
              "series-key": "MIN001.I.N",
              "MEASURE": "I",
              "SEASONAL_ADJUST": "N",
              "UNIT_MEASURE": "Index",
              "SOURCE_IDENTIFIER": "FMP20000",
              "LABEL": "Total, gold included"
            }
          ]
        }
      ]
    ]
  }
]'

Returns

{
  "success": "Data set release successfully staged"
}

Commit/release second release (data update)

curl -X 'POST' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0/commit?release=2025-04-23T14%3A37%3A00&description=Second%20release' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx' \
  -d ''

Returns

{
  "success": "Data set release successfully committed."
}

Read available release dates

curl -X 'GET' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0/release' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'

Returns

{
  "data-set": {
    "id": "MINING",
    "version": "0.0.0",
    "agencyid": "ECONDATA"
  },
  "releases": [
    {
      "release": "2025-04-23T12:37:00Z",
      "description": "Second release",
      "start-period": "2022-01-01",
      "end-period": "2022-03-01"
    },
    {
      "release": "2025-04-23T12:27:00Z",
      "description": "First release",
      "start-period": "2022-01-01",
      "end-period": "2022-02-01"
    }
  ]
}

Read latest release

curl -X 'GET' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0?release=2025-04-23T14%3A37%3A00' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'

Returns (notice that the return includes data from the first release as well as data updates from the second release)

{
  "data-sets": [
    {
      "provision-agreement": {
        "id": "MINING_ECONDATA_STATSSA",
        "version": "0.0.0",
        "agencyid": "ECONDATA"
      },
      "id": "MINING",
      "name": [
        "en",
        "Mining test data set"
      ],
      "version": "0.0.0",
      "RELEASE": "Unreleased",
      "series": [
        {
          "MNEMONIC": "MIN001",
          "obs": [
            {
              "TIME_PERIOD": "2022-01-01",
              "OBS_VALUE": 84.2
            },
            {
              "TIME_PERIOD": "2022-02-01",
              "OBS_VALUE": 80
            },
            {
              "TIME_PERIOD": "2022-03-01",
              "OBS_VALUE": 94.7
            }
          ],
          "FREQ": "M",
          "BASE_PER": "2015",
          "series-key": "MIN001.I.N",
          "MEASURE": "I",
          "SEASONAL_ADJUST": "N",
          "UNIT_MEASURE": "Index",
          "SOURCE_IDENTIFIER": "FMP20000",
          "LABEL": "Total, gold included"
        },
        {
          "MNEMONIC": "MIN002",
          "obs": [
            {
              "TIME_PERIOD": "2022-01-01",
              "OBS_VALUE": 91
            },
            {
              "TIME_PERIOD": "2022-02-01",
              "OBS_VALUE": 85
            },
            {
              "TIME_PERIOD": "2022-03-01",
              "OBS_VALUE": 103.1
            }
          ],
          "FREQ": "M",
          "BASE_PER": "2015",
          "series-key": "MIN002.I.N",
          "MEASURE": "I",
          "SEASONAL_ADJUST": "N",
          "UNIT_MEASURE": "Index",
          "SOURCE_IDENTIFIER": "FMP20001",
          "LABEL": "Total, gold excluded"
        }
      ],
      "SOURCE_DATASET": "P2041",
      "agencyid": "ECONDATA"
    }
  ],
  "structures": null,
  "header": {
    "id": "EconData",
    "prepared": "2025-04-23T12:39:47.998971066",
    "sender": "EconData web application",
    "receiver": "810c2268-2001-703a-5207-457704ed920f"
  }
}

Delete data set

Finally, we will clean up by deleting the data set

curl -X 'DELETE' \
  'https://dev.econdata.co.za/sdmx-codera/v1/datasets/ECONDATA-MINING-0.0.0' \
  -H 'accept: application/vnd.sdmx-codera.data+json' \
  -H 'authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'

Returns

{
  "success": "Data set successfully deleted."
}