Putting Cod tracker stats as a command

Ive been trying to put a command using the call of duty API for my real time stats in nightbot. Here is the link of the public API:
https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/gamer/cloudlevelz/profile/type/mp.

Here is the command i used but its not filling in the stats:
$(eval a=JSON.parse(decodeURIComponent($(querystring $(urlfetch json https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/gamer/cloudlevelz/profile/type/mp)))).data.lifetime.all.properties;Total Kills: ${a.kills} | Best KDR: ${a.bestKD} | Best Kill Streak: ${a.bestKillStreak} | Total Suicides: ${a.suicides} | Best Kills: ${a.bestKills} | Most Deaths: ${a.deaths})

Any help is appreciated.

@Cloudlevelz Heya, welcome to the community. Your link is giving the error.

{"status":"error","data":{"type":"com.activision.mt.common.stdtools.exceptions.NoStackTraceException","message":"Not permitted: not authenticated"}}

By the way, if the link is working then I would code like this.
Ex. from documentation

$(eval 
try {
api = $(urlfetch json https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/battle/gamer/iShot%2321899/profile/type/mp); 
a=api.all.lifetime.properties;
"Total Kills: " + a.kills +
" | Best KDR: " + a.bestKD +
" | Best Kill Streak: " + a.bestKillStreak +
" | Total Suicides: " + a.suicides +
" | Best Kills: " + a.bestKills +
" | Deaths: " + a.deaths +
} catch (e) {
"ERROR"
}
)

If everything goes right, then the output would be like this…

Total Kills: 5891 | Best KDR: 7.5 | Best Kill Streak: 19 | Total Suicides: 32 | Best Kills: 78 | Deaths: 4550

…else it will give ERROR

I think it is problem with API. Hope this article help. :|

Edit: Sorry, I forgot to type $(URLFetch) variable

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