Author

Topic: blockchain.info HTTP API support for CORS? (Read 3724 times)

brand new
Activity: 0
Merit: 0
Thanks for sharing.

It would be great if blockchain.info used cors on this call especially...
curl https://blockchain.info/uuid-generator?api_code=&format=json&n=2

Here is the start of a work-around:
Step 1 issue this command to start their server on your local machine
nohup blockchain-wallet-service start --port 3030 &
Step 2 generate uuids in advance and pass them to your javascript or python app
curl http://127.0.0.1:3030/api/v2/create?password=thepassword$$\&api_code=yourcode\[email protected]


newbie
Activity: 28
Merit: 0
You can now add a cors=true parameter to most requests if you need the header e.g.

http://blockchain.info/unspent?cors=true

Which API calls support CORS?

I can get the "Access-Control-Allow-Origin" header back with this:
Code:
curl -v -H "Origin: http://example.com" \
  -H "Access-Control-Request-Method: GET" \
  -H "Access-Control-Request-Headers: X-Requested-With" \
  -X GET \
  "https://blockchain.info/unspent?cors=true"

This does not respond with that header:
Code:
curl -v -H "Origin: http://example.com" \
  -H "Access-Control-Request-Method: GET" \
  -H "Access-Control-Request-Headers: X-Requested-With" \
  -X GET \
  "https://blockchain.info/rawaddr/1EJcR6wPdtjYp2WYo1XPYryv9zJE1e6XtU?cors=true"

Am I doing something wrong?
full member
Activity: 218
Merit: 100
You can now add a cors=true parameter to most requests if you need the header e.g.

http://blockchain.info/unspent?cors=true

Great, thanks so much!
hero member
Activity: 910
Merit: 1005
You can now add a cors=true parameter to most requests if you need the header e.g.

http://blockchain.info/unspent?cors=true
legendary
Activity: 2912
Merit: 1060
I'm assuming ajaxing the feeds
hero member
Activity: 910
Merit: 1005
What is the intended usage?
legendary
Activity: 2912
Merit: 1060
Damn could've used this when s3 couldn't serve fonts
sr. member
Activity: 287
Merit: 250
You could try to use corsproxy

Not sure about the load it can handle though.
full member
Activity: 218
Merit: 100
It would be absolutely awesome if blockchain.info could support CORS:

Access-Control-Allow-Origin: *

It would allow client-side projects to access the blockchain.info API without having to resort to hacks like using YQL.
Jump to: