Been banging my head against the wall for about a week with this.
I want to create a command that will show my real time stats for Modern Warfare but I can't figure it out. I have the public API link (https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/…) but can't get any further.
Call Of Duty API Command
11 replies
I wrote the following command code that outputs the following values: kills, bestKD, bestKillStreak, suicides, bestKills, deaths.
$(eval a=JSON.parse(decodeURIComponent(`$(querystring $(urlfetch json https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/gamer/squidlegz2014/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}`)
I'm not entirely sure what you mean, relatively new to this, im just looking for a way to pull realtime stats from https://cod.tracker.gg/warzone/profile/psn/Dumpauss/overview to be shown just like the command in this thread shows?
I was able to write a command for the original poster because they provided a URL that gave their COD stats in JSON format (https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/…) and told me specifically what stats they wanted Nightbot to output.
I want you to do the same. I may have found a URL for your COD stats (https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/…) but I'd like to you confirm those stats are yours as well as exactly what stats values in the JSON you want Nightbot to output.
It seems you've been playing since you replied, as your current stats are a little different now and took a while to find. I still managed to find what I think are the right stats.
$(eval a=JSON.parse(decodeURIComponent(`$(querystring $(urlfetch json https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/gamer/Dumpauss/profile/type/mp))`)).data.lifetime.mode.br_all.properties;`Total Wins: ${a.wins} | Total Kills: ${a.kills} | Best KDR: ${a.kdRatio} | Total Downs: ${a.downs} | Top 25: ${a.topTwentyFive} | Top 10: ${a.topTen} | Total Contracts: ${a.contracts} | Top 5: ${a.topFive} | Score: ${a.score}`)
Didn't find your answer? The community is on Discord.
Ask on Discord