Question about a warzone custom API command


I found a command which helps me fetching data from the cod tracker API.
The command is working for KD, weekly KD, kills and a lot of other things, but not for level.
For example

!addcom !wzstats -ul=moderator -a=_wzstats $(eval `$(querystring)`.toLowerCase().replace(`%20`,`/`))
!addcom _wzstats $(eval u=$(urlfetch json$(query));[1].stats;; r=s.kdRatio.value; k=s.kills.value; d=s.deaths.value;t=s.weeklyKdRatio.displayValue;h=s.weeklyHeadshotPct.value;`The stats of ${p} are >> Kills: ${k} | Deaths: ${d} | Overall K/D: ${r} | Weekly K/D: ${t} | Headshot: ${h} % | Profile Link >>$(query)/detailed`)

The command above is working.

But when I try to fetch the level with z=s.level.value , i get the answer "Cannot read property ‘value’ of undefined "

Can someone explain me why?

Hiya, sure I can explain why. In the command you posted, the stats are assigned to var s:[1].stats

The API has the stats divided in 3 sections, 0 = overview, 1 = warzone, 2 = plunder. So currently the variable s, only has access to the warzone section.
The user level is only available in the overview section, so you would need to access it like this:[0].stats.level.value

or ‘level.displayValue’ whatever you prefer.


hey. ty for the answer! <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.