<p>The port 18332 is the specification you speak of. 
When the testnet bitcoind is running on your system, port 18332 is open to accept rpc's. In case of mainnet, that port changes to 8332.</p>

<p>Every thing that you can do from the commandline is accessible via curl on that port.</p>

CC BY-SA 4.0
2018-06-27T20:00:56.243Z
Note that I did have to remove testnet=1 and rpcport=8332 from the bitcoin.conf in order to have this flexibility. Good answer.
toddmo
CC BY-SA 4.0
2018-06-27T19:53:59.580Z
2018-06-27T19:53:59.580Z
Shabahat M. Ayubi
<p>The <code>testnet=1</code> option can be (not) specified in the bitcoin.conf file (thus causing it to be on mainnet by default), and this can be over-ridden in <code>bitcoin-cli</code> with the <code>-testnet</code> command-line option.</p>

<p>But, when using the json-rpc interface via curl, I can't figure out how to specify I want testnet in this case. I can put the testnet port 18332 in the url, but I don't know how to use any other "command line" switches when using curl?</p>

<p>Can I do it with curl?</p>

<json-rpc><testnet>
How to specify testnet via curl against json-rpc?
toddmo
# How to specify testnet via curl against json-rpc?

(Asked by: username_0 on 2018-06-27)

The `testnet=1` option can be (not) specified in the bitcoin.conf file (thus causing it to be on mainnet by default), and this can be over-ridden in `bitcoin-cli` with the `-testnet` command-line option.

But, when using the json-rpc interface via curl, I can't figure out how to specify I want testnet in this case. I can put the testnet port 18332 in the url, but I don't know how to use any other "command line" switches when using curl?

Can I do it with curl?

**Tags:** json-rpc, testnet


---

## 1 answers

### Answer by username_1 on 2018-06-27. Score: 4 | Accepted answer

The port 18332 is the specification you speak of.
When the testnet bitcoind is running on your system, port 18332 is open to accept rpc's. In case of mainnet, that port changes to 8332.

Every thing that you can do from the commandline is accessible via curl on that port.

> **Comments:**
> **username_0**: Note that I did have to remove testnet=1 and rpcport=8332 from the bitcoin.conf in order to have this flexibility. Good answer.  

---

