wellsjo / cryptowatch-api

Cryptowatch api wrapper
MIT License
9 stars 4 forks source link

getting cryptowatch json info #6

Open rashearth opened 5 years ago

rashearth commented 5 years ago

Hi, thanks for making this, i really like to use this program. I am trying to fetch url from cryptowatch by using pure javascript. i have some question using it. Could you kindly share information?

・does this work on pure javascript? i implemented, but it says that "require" is not defined, which means its for python?

・please tell me how i could get information for underlined url.

https://api.cryptowat.ch/markets/bitflyer/btcfxjpy/ohlc?periods=300&before=1555114976479

Actually i have been using cryptowatch by setting CORS ("https://cors-anywhere.herokuapp.com") for fetching json from cryptowatch, but somehow from yesterday, it wont fetch... it says 403 forbidden for following fetch. That is why i would like to use your program.

var url="https://cors-anywhere.herokuapp.com/https://api.cryptowat.ch/markets/bitflyer/btcfxjpy/ohlc?periods=300&before=1555114976479"
fetch(url,{
             method: 'GET',
            headers: { 'Access-Control-Request-Origin': 'https://api.cryptowat.ch' }})
        .then(function(response) {

            return response.json();

        })

Thank you

matass commented 4 years ago

Hi, You can set up your own proxy server that will send appropriate CORS headers (e.g. allow requests only from your website), and then direct requests to it.

SuyashJoshi179 commented 3 years ago

Setting up own server still giving me an error 403: Forbidden, Origin not found. Why??