Blockexplorer.com API POST error

2

2

I'm trying to write Python code which utilises the (Insight) Blockexplorer.com API , particularly the POST functions. I'm testing using the iOS REST app, Restler (see screenshot).

The call I'm trying to make is fine when I use GET (https://testnet.blockexplorer.com/api/addrs/2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f/txs), however for POST, I'm having problems. I use "addrs" = "2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f" as my params (and have tried using dumped JSON, ie"{ "2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1f" }", but I'm always getting the following error message:

Invalid addrs param:Cannot call method 'split' of undefined. Code:1

It's clearly a parameters issue, so what gives? (FWIW I'm not versed in JavaScript)


Relevant screenshot of Restler (L) and API documentation (R):

Screenshot

Wizard Of Ozzie

Posted 2015-11-07T03:34:45.877

Reputation: 4 535

Answers

1

I was able to get the POST working. The error you're getting back seems to indicate the key "addrs" is not in the POST payload. Just a guess, but maybe you don't need the quotes and spaces around the payload?

Screenshot here:

enter image description here

Jimmy Song

Posted 2015-11-07T03:34:45.877

Reputation: 7 067

Very close!. It was the spaces between the = causing the issue. The payload must be a string without any spaces, ie, addrs=2NF2baYuJAkCKo5onjUKEPdARQkZ6SYyKd5,2NAre8sX2povnjy4aeiHKeEh97Qhn97tB1fWizard Of Ozzie 2015-11-08T05:04:51.637