Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
POST request to ProBasketballAPI.com using Javascript

I am trying to get data from the ProBasketballAPI.com API. The docs state the following:

'To make calls to the ProBasketball API, you must make a POST request to the specified URL. In this request you must pass along your API key, and that is it. You now have access to the API!

Of course you can pass along arguments other than just your API key, in fact, it is encouraged that you do so. It will help narrow down data that will be returned.

All responses will be in the JSON format.'

I am trying to pass the api_key as an argument as it states like this.

const options = {
    'api_key': JSON.stringify(api_key),
    method: 'post',
    headers: {
        'Content-Type': 'application/json'
    }
};

const x = fetch('https://probasketballapi.com/players', options);

x.then((response) => {
    const data = response.json();
    data.then((response) => {
        console.log(response)
    })
})

But I receive the following error from the api,

{ errors: [ 'The api key field is required.' ] }

I have read the documentation but I can not figure it out. The documentation can be found at https://probasketballapi.com/docs/authentication

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda