Function call failed Permission Denied

Hello,

I am trying to call a particle function through Mac Terminal using:

BensonKobisiMac:~ root# particle call device Electro-Lobo led on

and it returns:

Function call failed Permission Denied 

for reasons that escape me. I am logged in successfully. When I list the devices I get this:

BensonKobisiMac:~ root# particle cloud list
Electro-Lobo [2e0043001951343589561111] (Electron) is online
  Functions:
    int led(String args) 

can anyone suggest what might be the issue here? I’d much appreciate it.
thanks!!
Ben

I think particle help call could have given you this clue

That means that you insert your device_id (2e0043001951343589561111) but not the device name - and you need to drop the extra keyword device

I believe that the API call should work regardless of whether you reference the Device name or the Device ID.

thanks to the both of you!
both work.
just wrapping my head around all of this. :slight_smile:

Forget - brainfart :flushed:

@will, I’m not sure about that.
The API might accept both but for CLI (about which Benzi asked) I also get a Permission denied with the device name but the device ID works.

I’ve tested with 1.15.0

C:\Users\Andy>particle call ScruffyG3 restart now
Function call failed Permission Denied

C:\Users\Andy>particle call 2c...32 restart now
-1

C:\Users\Andy>particle call ScruffyG3 restart now
Function call failed Permission Denied

@Benzi, have you actually tested with device name again?

That’s weird. Using the device name (instead of device ID) for CLI call works on the Mac (CLI 1.15.0):

Call:

$ particle call test4 test foo
0

Serial:

testFunction(foo)

Code:

#include "Particle.h"

int testFunction(String arg);

void setup() {
	Serial.begin(9600);

	Particle.function("test", testFunction);
}

void loop() {
}

int testFunction(String arg) {
	Serial.printlnf("testFunction(%s)", arg.c_str());
	return 0;
}

Hi there, yes, I tested with device name and ID, and in both cases, it works.
Turns out my original call had the word ‘device’ in there before the name or ID and once removed, it worked.

1 Like

Doh’ - no wonder.
I recently renamed my device from ScruffyG3 to Scruffy3G but that did must have gone out of brain during the last defrag :blush:

Sorry for the rumble :stuck_out_tongue_closed_eyes:

1 Like

No problem! I’m glad that it was a naming typo and not a mysterious regression in our tools :stuck_out_tongue:

1 Like