Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
Fetch Api Call to a External Api results in CORS Error, But in Browser it works fine

I am trying to make a fetch call to a web server via apis.

var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch(
  "https://api-mainnet.magiceden.dev/v2/collections?offset=0&limit=3",
  requestOptions
)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

This seems to throw this error enter image description here

Access to fetch at 'https://api-mainnet.magiceden.dev/v2/collections?offset=0&limit=3' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

But the same url if I try to access in the browser . Displays the data. enter image description here Any help on how I can get the fetch api call to work would be much appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What Are your "requestOptions"? I've tried this, and it's working fine.

fetch("https://api-mainnet.magiceden.dev/v2/collections?offset=0&limit=3" )
            .then((response) => response.text())
            .then((result) => console.log(result))
            .catch((error) => console.log("error", error));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda