Regarding the use of setkey api

can anyone explain the significance of setKey(’{{ApiKey}}’,’{{Name}}’ in the led controlling code,as no third device is interfaced.
if i comment out this line,the code doesnt work!!!.
And if suppose a third device is interfaced,then instead of ‘Name’ syntax,should we use the device name,with which it is interfaced?

Hi @jainapeksha588,

Open this link https://cloud.boltiot.com/static/js/boltCommands.js

and check the function definition for setKey function.

function setKey(key,dev_name){
    api_key = key;
    d_name = dev_name;
}

setKey function takes the API key and Name(device id) as a parameter. ApiKey and Name will be auto initialized by bolt cloud.

Do let me know in case you need any other information.

@rahul.singh1 i get the defination,i wanted to know why it is used in LED controlling code,when no third device is interfaced.