API V2: issues with table from report

Hi all,

I am able to get into the API (using a combination of R and insomnia) and have got several stuff already drawn from it, to my endless joy. But now I’m trying to get a table from a report, and I get this:

{
“errors”: [
{
“message”: “startTime and endTime are the same value. Make sure to specify a non-zero time range. Use the fights query to obtain the time ranges of each fight.”,
“extensions”: {
“category”: “graphql”
},
“locations”: [
{
“line”: 1,
“column”: 70
}
],
“path”: [
“reportData”,
“report”,
“table”
]
}
],
“data”: {
“reportData”: {
“report”: {
“startTime”: 1604603500691,
“endTime”: 1604607410705,
“table”: null
}
}
}
}

with the call:

query{reportData{report(code:“MzJb38tjDZ9vwCFK”){startTime, endTime, table
}
}
}

Can anyone (maybe @Kihra) enlighten me as to how to get this report? Is it me, or is it a bug?

startTime and endTime are relative to the start of the report. They aren’t absolute times.

1 Like

Thank you, defining an endtime worked, though I just wanted the whole report and it’s stated as optional, but both are set at 0 so I get why that won’t work. For now, I set it at 10000000, which seems to work.

Hey @Kairi - I’m trying to get through the Insomnia API and I also wanted to pull data in R. Could you help me out with getting started/set-up? Would really appreciate the help, not finding much documentation online and I’m pretty noob with APIs in general.

Sure. What have you got? Can you get to the logs via Insomnia? That’s the first step. There I got the token from (yes, it should be possible to get that in R using httr, if you find how, let me know ;)).

You need the package library(ghql) and library(jsonlite), and then you can try:

client1 <- GraphqlClient$new(
url = “https://www.warcraftlogs.com/api/v2/client”,
header = list(Authorization = paste0("Bearer ", tok1))
)

(where tok1 is your token-string)

followed by:
i <- 1
qry <- paste0(“query{gameData{abilities(page:”, i, “){data{id, name} from, to}}}”)
qry2 <- Query$new()
qry2$query(‘queryfrag’, qry)
abilites <- fromJSON(client1$exec(qry2$queries$queryfrag))

for example, to get the first page of abilities.