When POSTing, does the argument need to be called args?

When I’m POSTing so that I can trigger a firmware function, it doesn’t seem to matter what I call my argument – args, params, or maurice (I just tried that for fun) – everything seems to be getting funneled into the String parameter in my function. Is that correct, that the name args is just a convention? I did notice that if I misspelled access_token, that did not work.

If this is indeed the case, I recommend that they mention the fact in the docs…

Since a Particle function can only ever take exactly one string argument, whatever you call it the value is just passed. So feel free to use “maurice” or “args” or whatever you like.

I don’t think this really needs to be doc’ed because then it could become a limitation if someday Particle functions can take more than one argument. For now just think of it as a benevolent bug–it doesn’t hurt anything.

1 Like

OK, thanks, bko, for your reply. I’ll just squirrel that factoid away, that the actual name of the argument is irrelevant.

On a similar note, int functionName(String command) also doesn’t require you to use ‘command’, which took me some time to figure out :wink:

2 Likes