Data upload procedure

  • Initial authentication

    Initial authentication is described in the Authentication subsection.

    For initial authentication, the email and password of an existing user are used. To do this, you need to send a POST request, for example:

    bash
    curl -i --header "Content-Type: application/json" \
         --request POST \
         --data '{"email":"user@local.net","password":"Str0ngPas$"}' \
         https://uztgs.uz/api/v1/auth/sign_in
  • Unloading a list of consumers

    To unload a list of consumers, you need to send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     --data '{"page":"2"}' \
     https://uztgs.uz/api/v1/customers

    Data is downloaded page by page ("total_pages": 7 - total number of pages, "current_page": 1 - current page).

    It is necessary to organize cyclical downloading of data by page number:

    json
    {"data":[
           {
            "id":13,
            "name":"O'ZBEKISTON YENGIL ATLETIKA FEDERATSIYASI",
            "subdivision_type_name":"Unit Owner",
            "inn":"0204875446",
            "contact_number":"+998-91-381-18-88"
    },
    ... ],
      "total_pages":8,
      "current_page":2,
      "next_page":3
    }

    For further data download ( downloading of value archives) we will need the following parameters:

    • ““id”: 13 (“customer_id”: “13”`) - identifier (unique key) of the consumer in the system.
  • Downloading the list of metering units

    To upload the list of metering nodes you should send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     --data '{"page":"2"}' \
     https://uztgs.uz/api/v1/stations
    

    Data is downloaded page by page (“total_pages”: 7 - total number of pages,“current_page”: 1 - current page).

    It is necessary to organize cyclic data download by page number.

    json
    {"data":[
    {
    "id":18,
            "name":"ООО \"Coca-Cola Ichimligi Uzbekistan\" LTD",
            "equipment_type_id":1,
            "equipment_brand_name":"BK",
            "phone":"+998-97-725-12-28",
            "equipment_id":61,
            "customer_id":14
        }
    ... ],
      "total_pages":9,
      "current_page":2,
      "next_page":3
    }

    For further data download ( downloading archives of values) we need the following parameters:

    • “equipment_id”: 61`-identifier of the metering device.

    For data harmonization (directories):

    • “customer_id”: 14`-customer identifier;
    • ``equipment_type_id'': 61 - identifier of the configuration type of the metering device.
  • Downloading object characteristics

    To download the characteristics of a metering unit you should send a GET request with the unit identifier in the path, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     https://uztgs.uz/api/v1/stations/134/characteristics

    The id is the metering unit identifier obtained when downloading the list of metering units.

  • Downloading metering device types

    To download metering device types you should send a POST request, for example:

    bash
    curl -i  --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
    --header "Content-Type: application/json"  \
    --data '{"page":"1"}' \
     https://uztgs.uz/api/v1/equipment_types

    It is necessary to organize cyclic data download by the following parameters:

    • page - page number.
  • Channels download

    To download channels with binding to the type of metering device you should send a POST request, for example:

    bash
    curl -i  --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
    --header "Content-Type: application/json"  \
    --data '{"equipment_type_id": "2", "page":"1"}' \
     https://uztgs.uz/api/v1/channel_archive_types

    It is necessary to organize cyclic data downloading by the following parameters:

    • equipment_type_id - identifier of the device configuration type;
    • page - page number.
  • Downloading device messages

    To download the message (event/error code) reference for a metering device type you should send a GET request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     "https://uztgs.uz/api/v1/message_equipment_types?equipment_type_id=11&page=1"

    Filter parameters are passed in the query string:

    • equipment_type_id - metering device type identifier;
    • archive_type_id - archive type identifier (optional, to narrow the selection);
    • page - page number.
  • Downloading of readings archives

    To download archives of readings it is necessary to send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     --data '{"archive_type": "hourly", "equipment_id":"25",  "fp_
    end":"2021-02-20", "fp_start":"2021-02-01", "page":"1"}' \
     https://uztgs.uz/api/v1/channel_data

    It is necessary to organize cyclic data downloading by the following parameters:

    • equipment_id - identifier of the metering device;
    • archive_type - archive type (see the reference book);
    • fp_start - start of time interval;
    • fp_end - end of time interval;
    • page - page number.
  • Downloading the archive for a period

    To download the archive for a period you should send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     --data '{"archive_type": "hourly", "equipment_id":"25",  "fp_
    end":"2021-02-20", "fp_start":"2021-02-01", "page":"1", "channel_
    consolidation": "1"}' \
     https://uztgs.uz/api/v1/channel_data

    It is necessary to organize cyclic data download by the following parameters:

    • equipment_id - identifier of the metering device;
    • archive_type - archive type (see the reference book);
    • fp_start - start of time interval;
    • fp_end - end of time interval;
    • page - page number;
    • channel_consolidation: 1 - unified upload parameter.
  • Downloading the configuration of the meter

    To download the meter configuration you should send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     --data '{"archive_type": "settings", "equipment_id":"25",
    "page":"1"}' \
     https://uztgs.uz/api/v1/channel_data

    It is necessary to organize cyclic data download by the following parameters:

    • equipment_id - identifier of the metering device;
    • archive_type = “settings”;
    • page - page number.
  • Downloading the date of the last communication session

    To upload the date of the last communication session of the metering unit you should send a POST request, for example:

    bash
    curl -i --header "access-token: *********************" \
    --header "token-type: Bearer" \
    --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET  \
    --header "Content-Type: application/json" \
    --data '{ "id": "1816"}' https://uztgs.uz/api/v1/stations/last_seance_
    event_time

    It is necessary to organize data download by parameter:

    • id - identifier of the metering node.
  • Downloading communication sessions

    To download telemetry communication sessions you should send a GET request, for example:

    bash
    curl -i --header "access-token: *********************" \
     --header "token-type: Bearer" \
     --header "client: **********************" \
     --header "uid: user@local.net" \
     --request GET \
     --header "Content-Type: application/json" \
     "https://uztgs.uz/api/v1/seances?telemetry_id=85&fp_start=2021-11-02&fp_end=2021-11-30&page=1"

    It is necessary to organize cyclic data download by the following parameters:

    • telemetry_id - telemetry unit identifier;
    • fp_start - start of time interval;
    • fp_end - end of time interval;
    • page - page number.
Last updated on

Was this page helpful?