Spark-cli spark function call string argument

While working on a little test, I ran into a semi bug in how the spark-cli spark function call command does not decode special characters when sent to the Spark. It’s probably better explained with an example:

CLI sends:
spark function call <CORE ID> test "The cake is a lie"

Spark receives:

I’m not sure if this is intentional or accidental (I’m guilty on many occasions), but thought I’d create a thread about it just in case.


Is it the same result output by the spark core when calling the command via other methods?

What’s the function ‘test’ doing when it receives the argument “The cake is a lie” ?

%20 are spaces and probably parsed by others (python nodejs etc) but not on the command line but i can’t confirm.


Saw your test code in the other thread.

Is that the output you got for: ?

Serial.print("INCOMING: ");

Best way is to do the test mentioned above :slight_smile:

Hi @wgbartley,

Thanks for reporting this! I’ve created an issue to track this here:


1 Like


i did some testing and would like to comment that this is an issue with the way the API call handles the argument with a space in between.

The space gets sent to the core as %20 and that is normal since the argument is treated as a string.

It’s not really a spark-cli issue but the way the API behaves in general.

eg. speed 50 or make coffee or sleep now

In my example, i used hello there as my argument

spark function call kennethlimcp blink "hello there"

The serial output when the function is called to display the argument is given as hello%20there

I used python and spark-cli to call the function API and got the same results

Only weird thing is that i tried to check for hello%20there as a matched argument but it didn’t worked as well

EDIT: @Dave I managed to get it working. So:

If a user decides to use arguments with space in between, their function should check for the %20 for it to work:


Spark-cli: spark function call kennethlimcp blink real fast

Spark code:

> int blinky(String command){
>  if (command == "real%20fast")
>     {
>        //do what you wanna do :D 
>         return 1;
>     }
>     else
>         return -1;
> }
1 Like

Since it’s a POST request, I wouldn’t expect the arguments to be url escaped in the same way, so I suspect the request shouldn’t be made with those replacements. I’ll want to do some more research into it. Can you share the chunk of python you’re using to make the request?


Ok I’ll share it when I get home :slight_smile:

It uses ‘requests’ module and the code is from a fellow :spark: owner which shared for cfod testing previously.

@Dave there you go! Pardon the poor coding if any :smiley:


Spark-cli: spark function call core_name function_name "arg with spaces'