All Products
Search
Document Center

IoT Platform:BatchAddDataForApiSource

Last Updated:Aug 21, 2023

Imports multiple external data records to IoT Platform at a time. Data that is imported to IoT Platform by calling the BatchAddDataForApiSource operation is called the data of an API data source. You can import multiple data records from an on-premises server or other platforms to IoT Platform for data analysis and processing.

Usage notes

You can import up to 100 data records at a time in a single call.

QPS limits

You can call this API operation up to three times per second per account.

Note The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes BatchAddDataForApiSource

The operation that you want to perform. Set the value to BatchAddDataForApiSource.

ApiId String Yes cxatswiniekxw***

The ID of the API data source.

ContentList Json Yes [{"key":"value1","ts":1637658286000},{"key":"value2","ts":1637658287000}]

The details of the data records that you want to import to IoT Platform. The value is a JSON list.

  • The list can contain up to 100 JSON objects.
  • Each object must include the ts field that specifies the time when the data record was generated. The value is a UNIX timestamp accurate to the millisecond.
IotInstanceId String Yes iot-0pp1n*****

The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console.

Important
  • If your instance has an ID, you must specify the ID for this parameter. Otherwise, the call fails.
  • If no Overview page or ID is generated for your instance, you do not need to configure this parameter.

For more information, see Overview.

In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

The error code returned if the call fails. For more information about error codes, see Error codes.

Data Map {"count":2,"hasNext":false,"items":[{"key":"value1","ts":1637658286000,"id":1234567890},{"key":"value2","ts":1637658287000,"id":1234567891}],"pageNum":1,"pageSize":2}

The details of the data records that are imported to IoT Platform. The details include the IDs of the data records. You can obtain the ID of a data record from the id field.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

RequestId String BB71E443-4447-4024-A000-EDE09922891E

The ID of the request.

Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=BatchAddDataForApiSource
&ApiId=cxatswiniekxw***
&ContentList=[{"key":"value1","ts":1637658286000},{"key":"value2","ts":1637658287000}]
&IotInstanceId=iot-0pp1n*****
&<Common request parameters>

Sample success responses

XML format

<BatchAddDataForApiSourceResponse>
  <RequestId>BB71E443-4447-4024-A000-EDE09922891E</RequestId>
  <Data>{"count":2,"hasNext":false,"items":[{"key":"value1","ts":1637658286000,"id":1234567890},{"key":"value2","ts":1637658287000,"id":1234567891}],"pageNum":1,"pageSize":2}</Data>
  <Code></Code>
  <Success>true</Success>
</BatchAddDataForApiSourceResponse>

JSON format

{
    "RequestId": "BB71E443-4447-4024-A000-EDE09922891E",
    "Data": "{\"count\":2,\"hasNext\":false,\"items\":[{\"key\":\"value1\",\"ts\":1637658286000,\"id\":1234567890},{\"key\":\"value2\",\"ts\":1637658287000,\"id\":1234567891}],\"pageNum\":1,\"pageSize\":2}",
    "Code": "",
    "Success": true
}

Error codes

For a list of error codes, see Service error codes.