sei-ec-remote / project-2-issues

1 stars 0 forks source link

How do I connect to my API? #89

Closed danstacy1 closed 2 years ago

danstacy1 commented 2 years ago

What's the problem you're trying to solve?

My API is a npm install and I can not figure out how to connect to it. I have read the documentation and it is still not working.

Post any code you think might be relevant (one fenced block per file)

http://espn-fantasy-football-api.s3-website.us-east-2.amazonaws.com/

const api = require('espn-fantasy-football-api/node');

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

**I am not getting an error message.

What is your best guess as to the source of the problem?

Either, I need to declare a different const somewhere else or I am not calling the data correctly. Or both.

What things have you already tried to solve the problem?

I read the documentation on how to get the data from the API and I have copied and pasted the code but it is not working.

Paste a link to your repository here

https://github.com/danstacy1/Project_2.git

kestler01 commented 2 years ago

have you tried console.logging out the api variable after your assignment ? in the docs it has the syntax set to destructure out everything inside of module with the { ... }

danstacy1 commented 2 years ago

Yeah, I tried that but I'm not getting anything.

danstacy1 commented 2 years ago

Update: I'm getting some info in my terminal now, but it is only a few data keys (not all of them) and the value says [Getter]

kestler01 commented 2 years ago

sharing that would be helpful

danstacy1 commented 2 years ago

this is my data Object [Module] { Boxscore: [Getter], BoxscorePlayer: [Getter], Client: [Getter], FreeAgentPlayer: [Getter], Player: [Getter], PlayerStats: [Getter], Team: [Getter]

kestler01 commented 2 years ago

also How to Get Data Creating a Client This will allow you to call the various methods on the Client class to grab data for the passed league. For working with multiple leagues, create multiple Client instances.

import { Client } from 'espn-fantasy-football-api';
const myClient = new Client({ leagueId: 432132 });
danstacy1 commented 2 years ago

I'm confused by that part. Not really sure what to do there.

danstacy1 commented 2 years ago

When I put the client code into my code, it breaks everything.

kestler01 commented 2 years ago

closing for now since the api is no longer maintained