Closed EnsuingRequiem closed 6 years ago
Hi, thanks for submitting an issue! It looks like that part of the api isn't implemented yet. Though it looks like a pretty easy addition. Let me check in a few things and see if that gets you what you need.
Original query still doesn't work (404: Bad Request Error), but the following now works in the new branch:
# Install package at feature branch.
devtools::install_github("detroyejr/igdb", ref = "feature/expand")
# Working query.
pkmn <- igdb::igdb_games(
search = "pokemon",
filter = "[developers][eq]=1617",
n = 20, order = "first_release_date:asc",
fields = c("game.name", "developers.name", "first_release_date"),
expand = "developers"
)
Can you verify that the query you originally attempted is correct? And, then verify that the output is what you're expecting?
I did have to make one change to the original query, but I actually prefer it the way implemented. expand = "companies"
became expand = " developers"
. The output appears correct and I went ahead to try a couple of other scenarios (I'm new to both R and APIs). Looking at the first example presented, the query can accept multiple expanders (same for filters). Is the preferred method of inputting these something along the lines of expand = "developers,franchise"
or more like the fields input which is fields = c("name", "developers.name", "first_release_date", "franchise.name")
?
This is the query I have with multiple filters & expanders in a format that works:
# Query with compound filters and compound expands
pkmn <- igdb::igdb_games(
search = "pokemon",
filter = "[developers][eq]=1617&filter[franchise][eq]=60",
n = 10,
order = "first_release_date:asc",
fields = c("name", "developers.name", "first_release_date", "franchise.name"),
expand = "developers,franchise"
)
Here is the properly formed query from the original comment:
# Query from the original issue post
pkmn <- igdb::igdb_games(
search = "pokemon",
filter = "[developers][eq]=1617",
n = 10,
order = "first_release_date:asc",
fields = c("name", "developers.name", "first_release_date"),
expand = "developers"
)
When attempting to use the expander function of the IGDB API, R returns an error.
Code returning the error:
pkmn <- igdb::igdb_games(search = "pokemon", filter = "[developers][eq]=1617", n = 20, order = "first_release_date:asc", fields = c("name", "developers.name", "first_release_date"), expand = "companies")
Error received:
Error in igdb::igdb_games(search = "pokemon", filter = "[developers][eq]=1617", : unused argument (expand = "companies")