Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

players.leagues cannot use comma separated list of player statuses in filter's status property #85

Open
Liam-OShea opened this issue Sep 3, 2021 · 3 comments

Comments

@Liam-OShea
Copy link

Hi Luke!

I noticed that the players.leagues endpoint does not work when providing more than one status in the filter object.

Here is an example of how I construct the query:
statuses = "T,K"
const filter = { start: i, status: statuses // Comma separated list of statuses }

const players = await yf.players.leagues(league_key, filter, subresources)

I tried supplying the statuses in three separate ways, here are the results:

statuses = "T,K"

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js
{
'xml:lang': 'en-us',
'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=50;status=T,K?format=json',
description: 'Invalid status filter option provided.',
detail: ''
}

statuses = "T, K" // With a space

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
at new ClientRequest (_http_client.js:148:13)
at Proxy.request (https.js:314:10)
at C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:279:10
at new Promise ()
at YahooFantasy.api (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:277:12)
at PlayersCollection.leagues (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\collections\playersCollection.mjs:96:8)
at getPlayers (C:\Users\liamo\Documents\Work\Yahoo API\main.js:55:30)
at main (C:\Users\liamo\Documents\Work\Yahoo API\main.js:13:18)
at Object. (C:\Users\liamo\Documents\Work\Yahoo API\main.js:81:2)
at Module._compile (internal/modules/cjs/loader.js:1138:30) {
code: 'ERR_UNESCAPED_CHARACTERS'
}

statuses = ["T","K"]

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js
{
'xml:lang': 'en-us',
'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=0;status=T,K?format=json',
description: 'Invalid status filter option provided.',
detail: ''
}

This seems to be an issue with how Yahoo accepts the parameters, rather than with how the wrapper is processing them.

@japhy-snyder
Copy link

japhy-snyder commented Sep 4, 2021 via email

@whatadewitt
Copy link
Owner

Interesting... Indeed it's not working...

This makes me believe that perhaps they've removed this functionality on their side at some point since I originally wrote the docs 7 years ago... Their docs don't specify we can use multiple filters... but they aren't always the most reliable.

If my contact gets back to me I'll follow up with a question about this.

@Liam-OShea
Copy link
Author

Hmm.. I thought I had used this feature while experimenting a couple months ago and that it had worked - although I may be misremembering. Sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants