rom-exchange-web icon indicating copy to clipboard operation
rom-exchange-web copied to clipboard

unable to fetch data from the api

Open nilsontan opened this issue 6 years ago • 3 comments

Hi Jessica,

I get this error when trying to consume your api with axios.

Access to XMLHttpRequest at 'https://www.romexchange.com/api?item=mastela&exact=false' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

nilsontan avatar Feb 19 '19 05:02 nilsontan

Hi @nilsontan! Unfortunately I'm unable to remove that restriction at the moment (it's a limitation of the web host). I'll keep searching for the best workaround for it. I know it kind of makes it difficult to create your own web client using the API (non-web tools like bots and command line programs are unaffected) until that restriction is removed.

JessicaYeh avatar Feb 19 '19 19:02 JessicaYeh

let me know if u manage the data available. been trying to pull the data myself only stumbled upon this comment. cheers

nezam7 avatar Mar 09 '19 02:03 nezam7

You just need to add the header 'User-Agent'. The next example is on python

x = requests.get(
    'https://www.romexchange.com/api',
    params={'item':item},
    headers={'User-Agent': 'RomCalculator/0.0.1'})

SinueeHernandez avatar Nov 05 '19 16:11 SinueeHernandez