<p>Using C-lightning RPC interface you can avoid specifying optional parameters, just by not specifying them. Using the console in Spark wallet shouldn't be different.</p>
<p>You can refer to a specific optional argument by its name while omitting the others by using the <a href="https://lightning.readthedocs.io/lightning-cli.1.html#options" rel="nofollow noreferrer"><code>-k</code> command line option of <code>lightning-cli</code></a>. So for the example your gave:</p>
<pre class="lang-bash prettyprint-override"><code>lightning-cli -k getroute id=024...a67 msatoshi=1000000sat riskfactor=10 exclude='[&quot;564334x877x1/0&quot;,&quot;564195x1292x0/1&quot;]'
</code></pre>
<p>I don't know if Spark provides a way to refer to options by their name. You can always just specify the default of the options <a href="https://lightning.readthedocs.io/lightning-getroute.7.html" rel="nofollow noreferrer">as documented</a>.</p>

CC BY-SA 4.0
2021-06-23T10:23:28.653Z
Thanks. When I enter the above, including the square brackets, I get the following error: exclude: should be an array: invalid token '"[“687193x890x0/0”,“687193x890x0/1”]"'
runam0k
CC BY-SA 4.0
2021-06-23T10:36:06.923Z
This is a quote escape issue. Use single quotes around the array.
Antoine Poinsot
CC BY-SA 4.0
2021-06-23T10:52:57.473Z
Thanks. I included single quotes around the array - '["687193x890x0/0","687193x890x0/1"]' - and now get the error: exclude: should be an array: invalid token '"[\"687193x890x0/0\",\"687193x890x0/1\"]"'
runam0k
CC BY-SA 4.0
2023-08-13T09:08:01.547Z
Take a look to the double quote posted in the solution, there are wrong! See why here https://bitcoin.stackexchange.com/a/119278/91194
vincenzopalazzo
CC BY-SA 4.0
2021-06-23T10:19:23.423Z
2023-08-14T09:42:06.637Z
2023-08-14T09:42:06.637Z
Antoine Poinsot
<p>Ok posting a solution of the <a href="https://bitcoin.stackexchange.com/a/107205/91194">https://bitcoin.stackexchange.com/a/107205/91194</a></p>
<p>Sorry if the command line params in JSON are a little bit a mess in core lightning, but it is the best standard format that we found.</p>
<p>The problem is that there is a very difference between double quotes in OSX and double quotes in Linux. Simply are different and our parser go crazy!</p>
<p>So take the example inside the answer of Antonie, he has a OSX system base just because the quote posted is <code>“</code> and not <code>&quot;</code>.</p>
<p>So if you run now the command with this difference in mind</p>
<pre class="lang-bash prettyprint-override"><code>clightning -k --testnet getroute id=03b39d1ddf13ce486de74e9e44e0538f960401a9ec75534ba9cfe4100d65426880 amount_msat=1000 riskfactor=1 exclude='[&quot;564334x877x1/0&quot;,&quot;564195x1292x0/1&quot;]'
{
   &quot;route&quot;: []
}

</code></pre>
<p>Done! but if you can open a issue by linking this answer we try to find a solution for this parser bug (I am not sure that it is a bug btw)</p>

CC BY-SA 4.0
2023-08-14T08:22:40.177Z
For what it's worth @vincenzopalazzo i don't have an OSX-based system. No idea how comes the quotes in my answer seem backward.
Antoine Poinsot
CC BY-SA 4.0
2023-08-14T09:37:33.940Z
@AntoinePoinsot Yeah I was thinking why you were using OSX based too, but this happens with OSX a lot, I am not sure if there is another way to write them too
vincenzopalazzo
CC BY-SA 4.0
2023-08-13T09:07:08.703Z
2023-08-13T09:07:08.703Z
vincenzopalazzo
<p>I am trying to use the <code>getroute</code> command, specified as such:</p>
<pre><code>getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]
</code></pre>
<ol>
<li>Do I need to include all the elements above, or can I ignore the optional elements (which I understand to be the ones in square brackets) and rely on their default values?</li>
<li>If I can ignore the optional elements, how do I do that?</li>
<li>How can i specify the <code>exclude</code> parameter? I had an error trying with:
<pre><code>getroute 024...a67 1000000sat 10 exclude=&quot;687193x890x0/0, 687193x890x0/1&quot;
</code></pre>
</li>
</ol>
<p>(I am using Spark wallet's RPC console, FYI.)</p>

<core-lightning>
Syntax for c-lightning RPC commands
runam0k
# Syntax for c-lightning RPC commands

(Asked by: username_0 on 2021-06-23)

I am trying to use the `getroute` command, specified as such:

```
getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]

```

1. Do I need to include all the elements above, or can I ignore the optional elements (which I understand to be the ones in square brackets) and rely on their default values?
2. If I can ignore the optional elements, how do I do that?
3. How can i specify the `exclude` parameter? I had an error trying with:

   ```
   getroute 024...a67 1000000sat 10 exclude="687193x890x0/0, 687193x890x0/1"

   ```

(I am using Spark wallet's RPC console, FYI.)

**Tags:** core-lightning


---

## 2 answers

### Answer by username_1 on 2021-06-23. Score: 0

Using C-lightning RPC interface you can avoid specifying optional parameters, just by not specifying them. Using the console in Spark wallet shouldn't be different.

You can refer to a specific optional argument by its name while omitting the others by using the [`-k` command line option of `lightning-cli`](https://lightning.readthedocs.io/lightning-cli.1.html#options). So for the example your gave:

```bash
lightning-cli -k getroute id=024...a67 msatoshi=1000000sat riskfactor=10 exclude='["564334x877x1/0","564195x1292x0/1"]'

```

I don't know if Spark provides a way to refer to options by their name. You can always just specify the default of the options [as documented](https://lightning.readthedocs.io/lightning-getroute.7.html).

> **Comments:**
> **username_0**: Thanks. When I enter the above, including the square brackets, I get the following error: exclude: should be an array: invalid token '"[“687193x890x0/0”,“687193x890x0/1”]"'  
> **username_1**: This is a quote escape issue. Use single quotes around the array.  
> **username_0**: Thanks. I included single quotes around the array - '["687193x890x0/0","687193x890x0/1"]' - and now get the error: exclude: should be an array: invalid token '"[\"687193x890x0/0\",\"687193x890x0/1\"]"'  
> **username_2**: Take a look to the double quote posted in the solution, there are wrong! See why here https://bitcoin.stackexchange.com/a/119278/91194  

---

### Answer by username_2 on 2023-08-13. Score: 0

Ok posting a solution of the <https://bitcoin.stackexchange.com/a/107205/91194>

Sorry if the command line params in JSON are a little bit a mess in core lightning, but it is the best standard format that we found.

The problem is that there is a very difference between double quotes in OSX and double quotes in Linux. Simply are different and our parser go crazy!

So take the example inside the answer of Antonie, he has a OSX system base just because the quote posted is `“` and not `"`.

So if you run now the command with this difference in mind

```bash
clightning -k --testnet getroute id=03b39d1ddf13ce486de74e9e44e0538f960401a9ec75534ba9cfe4100d65426880 amount_msat=1000 riskfactor=1 exclude='["564334x877x1/0","564195x1292x0/1"]'
{
   "route": []
}

```

Done! but if you can open a issue by linking this answer we try to find a solution for this parser bug (I am not sure that it is a bug btw)

> **Comments:**
> **username_1**: For what it's worth @username_2 i don't have an OSX-based system. No idea how comes the quotes in my answer seem backward.  
> **username_2**: @username_1 Yeah I was thinking why you were using OSX based too, but this happens with OSX a lot, I am not sure if there is another way to write them too  

---

