Reporting the File Type Measurement Point


The topic used for reporting the file type measurement point is /multipart/sys/{productKey}/{deviceKey}/thing/measurepoint/post HTTP/1.1.


The complete URL format for file type measurement point data reporting is https://{HTTP_Broker_URL}/multipart/sys/{productKey}/{deviceKey}/thing/measurepoint/post HTTP/1.1, where:

  • {productKey} is the product key of the device.
  • {deviceKey} is the device key of the device.


The format of the request body is multipart/form-data, consisting of multiple form-data sections. For a request body:

  • There must only be one request message. The request message takes up the space of one form-data and its format is “request form-data”. The header and body of the “request form-data” are shown in the tables below.
  • There can be one or multiple file form-data. If a request body contains file data, one file takes up the space of one file form-data. Its format is “file form-data”. The header of a “file form-data” is shown in the table below. If the measurement point data does not include file type data, there is no need to provide the file form-data.

Request Sample

POST /topic/sys/{ProductKey}/{DeviceKey}/thing/measurepoint/post HTTP/1.1
Host: {HTTP_Broker_URL}
Query-Parameter: sessionId={SessionId}

requestBody:
Request message form-data
Content-Disposition: form-data; name="enos-message"
{
    "method":"integration.measurepoint.post",
    "id":"123",
    "version":"1.1",
    "params":[
        {
            "productKey":"productKey1",
            "deviceKey":"deviceKey1",
            "time":1579580182824,
            "measurepoints":{
                "intMesurepintId1":123,
                "fileMeasurepointId1":"local://filename1"
            }
        },
        {
            "assetId":"assetId2",
            "time":1579580182824,
            "measurepoints":{
                "intMesurepintId2":123,
                "fileMeasurepointId2":"local://filename2"
            }
        }
    ],
    "files":{
        "filename1":{
            "featureId":"fileMeasurepointId1",
            "produckKey":"productKey1",
            "deviceKey":"deviceKey1",
            "md5":"0e202f9b67323d11df8a79b319a3d4f6"
        },
        "filename2":{
            "featureId":"fileMeasurepointId2",
            "assetId":"assetId2",
            "md5":"aa8ea05bdbcbadfcda7300c65c40859f"
        }
    }
}

File form-data
Content-Disposition: form-data; name="enos-file"; filename="filename1"
Content-Length: 1024000
<Content of file filename1>

File form-data
Content-Disposition: form-data; name="enos-file"; filename="filename2"
Content-Length: 1024000
<Content of file filename2>

Return Sample

body:
{
    "id":"123",
    "code":200,
    "message": "success",
    "data":{}
}

Parameter Description

Header of the request form-data
Name Mandatory/optional Data Format Description
Content-Disposition Mandatory Content-Disposition: form-data; name=”enos-message” name is a constant that indicates the name of the request message.
Body of the request form-data
Name Mandatory/optional Data Type Description
method Mandatory String The request method.
id Optional Integer The request message ID.
version Mandatory String The version number.
params Mandatory Array of Attribute Structs An array of Attribute Structs. See the table below for the structure of an Attribute Struct.
files Mandatory Map The mapping between files and asset attributes, presented by key-value pairs format. For more details, see the File Mapping Struct table below.

Note

Use one of the following methods to identify the asset to be linked.

  • Include the assetId in the request.
  • Include both productKey and deviceKey in the request.
Attribute Struct
Name Mandatory/optional Data Type Description
assetId Optional (See Note above) String The asset ID.
productKey Optional (See Note above) String The product key. To be used with deviceKey.
deviceKey Optional (See Note above) String The device key. To be used with productKey.
time Mandatory Long The timestamp of the measurement point data.
measurepoints Mandatory Map The measurement point data in the key-value pair format of “measurement point ID: measurement point value”. If the measurement point ID is a file type, its value will be local://filename, where local:// is the fixed format header and filename is the file name.


File Mapping Struct
Name Mandatory/optional Data Type Description
featureId Mandatory String The measurement point ID.
assetId Optional String The asset ID.
productKey Optional String The product key.
deviceKey Optional String The device key.
md5 Optional String The MD5 of the file.


Header of the file form-data
Name Mandatory/optional Data Format/Type Description
Content-Disposition Mandatory Content-Disposition: form-data; name=”enos-file”; filename=”yourFileName” name is a fixed value, and the filename is its corresponding file name.
Content-Length Mandatory Long The file size in bytes.