This endpoint copies one or more Variable(s) Values to other specified and existing Variable(s).
Request
To copy one or more Variable(s) Values please make a POST request to the following URL:
| HTTP Method | URL |
|---|---|
| POST | https://industrial.api.ubidots.com/api/v2.0/variables/_/migrate_values/ |
Query Parameters
| Parameter | Type | Use | Description |
|---|---|---|---|
| token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Body Parameters
| Parameter | Type | Required? | Default Value | Description |
|---|---|---|---|---|
| variables | Array | Yes | N/A (required) | Array of Objects containing to and from Arrays, please see example below |
| startDate | Number | No | Start date from which Values are copied, if not provided Values are copied from the very first Value | |
| endDate | Number | No | End date to which Values are copied, if not provided Values are copied until last Value |
AttentionPlease note that both Variables have to exist and that the authentication token has to have permissions to view and edit Variables.
variablesArray of BodyPlease see a valid example of the
variablesarray in the body below:
Header
| Parameter | Type | Description |
|---|---|---|
| X-Auth-Token | String | Authentication Token of account |
| Content-Type | String (application/json) | Content type of body |
//variables body attribute
//Please note that "device" key is optional if Variable is an Id, otherwise it's required
"variables": [
{
"from": { "variable": originVariable1ID },
"to": { "device": "~targetDevice1", "variable": "~targetVariable1" }
},
{
"from": { "variable": originVariable2ID },
"to": { "device": "~targetDevice2", "variable": "~targetVariable2" }
},
{
"from": { "variable": originVariableNID },
"to": { "device": "~targetDeviceN", "variable": "~targetVariableN" }
}
]curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/variables/_/migrate_values/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"variables": [
{
"from": { "variable": "5f073bfb4763e7780a77bba2" },
"to": { "device": "~device1", "variable": "~variable1" }
}
],
"startDate": None,
"endDate": None
}}'{
"task": {
"id": "5ebda96e73efc323d89a628c"
}
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}Response
Returns a Task Id of the asynchronous process.
