API problem -- Can you help me plz :)


Joined
Nov 15, 2022
Messages
6
Reaction score
0
Hello guys, I got api from football-data.org and they give me a token key when i register .... I test it on Postman and it's worked greatly .. when i tried to use it in my project i got errors idk why .. i watched 2 videos -- one of them using fetch and the the other using axios but it's didn't work !!
 
Ad

Advertisements

Ad

Advertisements

Joined
Nov 15, 2022
Messages
6
Reaction score
0
Screenshot_7.png

This is the api test on postman it works

________________________________________________________________________________________________________________________________________
<!-- axios library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.0/axios.min.js" integrity="sha512-OdkysyYNjK4CZHgB+dkw9xQp66hZ9TLqmS2vXaBrftfyJeduVhyy1cOfoxiKdi4/bfgpco6REu6Rb+V2oVIRWg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<!-- script sheet -- >
const token = "********************************";
let baseUrl = "https://api.football-data.org/v4"
function getStandings()
{
const url = `${baseUrl}/competitions/2000/standings`
axios.get(url, {
headers: {
"X-Auth-Token": `${token}`
}
})
.then((response) => {

console.log(response.data)
}
)}
getStandings()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top