Copy Variables(s) Values

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 MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/variables/_/migrate_values/

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Default ValueDescription
variablesArrayYesN/A (required)Array of Objects containing to and from Arrays, please see example below
startDateNumberNoStart date from which Values are copied, if not provided Values are copied from the very first Value
endDateNumberNoEnd date to which Values are copied, if not provided Values are copied until last Value

🚧

Attention

Please note that both Variables have to exist and that the authentication token has to have permissions to view and edit Variables.

📘

variables Array of Body

Please see a valid example of the variables array in the body below:

Header

ParameterTypeDescription
X-Auth-TokenStringAuthentication Token of account
Content-TypeString (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.