• The moderators of this forum are Austin and pre.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon.

Resource Usage Stats API

Hi

I wrote an API to easily fetch usage stats for a specific pokemon in a specific tier. The API has 2 supported endpoints:

Potential uses:
- discord bots
- PS bots
- userscripts

Code:
/tier/pokemon
Returns the most recent usage stats for the specified pokemon in the specified tier.

EX:

https://smogon-usage-stats.herokuapp.com/gen8ou/clefable

JSON:
{"tier":"gen8ou","pokemon":"Clefable","rank":"2","usage":"34.02292%","raw":"675606","abilities":{"Magic Guard":"89.781%","Unaware":"10.082%","Cute Charm":"0.137%"},"items":{"Leftovers":"68.880%","Life Orb":"25.773%","Sticky Barb":"3.187%","Other":"2.160%"},"spreads":{"Calm":{"252/0/0/4/252/0":"10.994%","252/0/160/0/96/0":"9.822%","252/0/4/0/252/0":"9.636%"},"Bold":{"252/0/252/0/4/0":"6.645%","252/0/252/4/0/0":"3.192%"},"Modest":{"196/0/0/252/0/60":"3.693%"},"Other":"56.019%"},"moves":{"Moonblast":"99.135%","Wish":"51.661%","Protect":"43.770%","Soft-Boiled":"36.336%","Flamethrower":"28.594%","Calm Mind":"21.283%","Stealth Rock":"20.867%","Thunder Wave":"20.573%","Thunderbolt":"17.715%","Aromatherapy":"15.313%","Moonlight":"13.631%","Knock Off":"4.031%","Trick":"3.970%","Heal Bell":"3.877%","Other":"19.245%"},"teammates":{"Corviknight":"+16.465%","Seismitoad":"+7.038%","Toxapex":"+6.647%","Rotom-Heat":"+5.679%","Hydreigon":"+4.064%","Mandibuzz":"+2.766%","Hippowdon":"+2.000%","Conkeldurr":"+1.937%","Kyurem":"+1.809%","Gastrodon":"+1.382%","Rotom-Wash":"+0.919%","Tyranitar":"+0.848%"},"checks":{"Bisharp":{"ko":"24.7%","switched":"61.0%"},"Gengar":{"ko":"15.4%","switched":"67.6%"},"Excadrill":{"ko":"9.8%","switched":"70.1%"},"Centiskorch":{"ko":"7.2%","switched":"82.2%"},"Aegislash":{"ko":"12.9%","switched":"64.3%"},"Durant":{"ko":"27.5%","switched":"63.4%"},"Venusaur":{"ko":"30.3%","switched":"49.8%"},"Diggersby":{"ko":"20.4%","switched":"60.4%"},"Melmetal":{"ko":"10.5%","switched":"64.8%"},"Dracovish":{"ko":"29.8%","switched":"41.1%"},"Copperajah":{"ko":"12.9%","switched":"70.6%"},"Salazzle":{"ko":"7.6%","switched":"73.1%"}}}
Tier: Tier that was provided
Pokemon: Pokemon that was provided
Rank: Ordinal ranking of the pokemon based on usage
Usage: Usage percentage
Raw: # of times the pokemon was used.
Abilities: Usage percentage for each ability the pokemon has.
Items: Item usage percentage for the pokemon specified
Spreads: usage percentage of a variety of EV spreads based on nature
Teammates: Typical teammates associated with this pokemon
Checks: Typically unfavored pokemon and the percentage of times the pokemon switches out / is KO'ed by each specific check


For more specific data grabbing:

Code:
/year/month/tier/rank/pokemon
important note about "rank": generally, it's 1630 for all tiers but OU, where its 1695. (be mindful of this when making requests)

Example Usage


JavaScript:
'use strict';

const https = require('https');

https.get('https://smogon-usage-stats.herokuapp.com/2019/12/gen8ou/1695/dragapult', res => {
    let data = '';
    res.on('data', chunk => {
        data += chunk;
    }).on('end', () => {
        console.log(data); //  {"tier":"gen8ou","pokemon":"Dragapult","rank":"1","usage":"39.26222%","raw":"1932908","abilities":{"Infiltrator":"85.399%","Clear Body":"11.368%","Cursed Body":"3.232%"},"items":{"Choice Specs":"43.190%","Leftovers":"20.751%","Life Orb":"11.180%","Choice Scarf":"10.954%","Choice Band":"7.178%","Expert Belt":"2.254%","Other":"4.493%"},"spreads":{"Timid":{"0/0/0/252/4/252":"32.522%","4/0/0/252/0/252":"3.119%"},"Modest":{"0/0/0/252/4/252":"11.529%","0/0/4/252/0/252":"3.231%"},"Adamant":{"0/252/0/0/4/252":"8.876%"},"Jolly":{"0/252/0/0/4/252":"6.801%"},"Other":"33.922%"},"moves":{"Shadow Ball":"57.759%","Draco Meteor":"57.146%","Fire Blast":"41.973%","U-turn":"37.239%","Thunderbolt":"35.738%","Dragon Darts":"29.379%","Phantom Force":"25.232%","Substitute":"21.532%","Dragon Dance":"18.610%","Flamethrower":"17.028%","Will-O-Wisp":"12.074%","Hex":"11.850%","Sucker Punch":"10.086%","Disable":"9.212%","Other":"15.141%"},"teammates":{"Bisharp":"+2.420%","Corviknight":"+1.474%","Excadrill":"+1.135%","Ditto":"+1.021%","Obstagoon":"+0.915%","Darmanitan-Galar":"+0.809%","Rotom-Wash":"+0.801%","Cloyster":"+0.768%","Clefable":"+0.521%"},"checks":{"Grimmsnarl":{"ko":"13.5%","switched":"62.4%"},"Sylveon":{"ko":"14.1%","switched":"61.4%"},"Bisharp":{"ko":"28.2%","switched":"44.8%"},"Mimikyu":{"ko":"31.3%","switched":"40.6%"},"Tyranitar":{"ko":"14.2%","switched":"51.2%"},"Clefable":{"ko":"17.5%","switched":"43.5%"},"Ditto":{"ko":"22.8%","switched":"34.0%"},"Alcremie":{"ko":"13.1%","switched":"61.5%"}}}
    });
});
;
HOSTED HERE: https://smogon-usage-stats.herokuapp.com/
 
Last edited:

DaWoblefet

Demonstrably so
is a Battle Simulator Administratoris a Smogon Social Media Contributoris a Community Leaderis a Top Researcheris a Tiering Contributor
PS Leader
Is data from the moveset folder obtainable via this API? For example, I could make the request to https://smogon-usage-stats.herokuapp.com/2020/02/gen8vgc2020/1760/togekiss for the rank at which Togekiss exists in that tier for that month, but is there a way to retrieve data from moveset? I would love to implement a .usage pokemon command for the VGC room bot taking advantage of moveset data and displaying it in a fancy way via an htmlbox, but I don't think I have much use for the rank and usage % data by itself.
 
Is data from the moveset folder obtainable via this API? For example, I could make the request to https://smogon-usage-stats.herokuapp.com/2020/02/gen8vgc2020/1760/togekiss for the rank at which Togekiss exists in that tier for that month, but is there a way to retrieve data from moveset? I would love to implement a .usage pokemon command for the VGC room bot taking advantage of moveset data and displaying it in a fancy way via an htmlbox, but I don't think I have much use for the rank and usage % data by itself.
not as of right now but i definitely see the use for that! ill work on adding that as we speak and it should be added by the end of today. Thank you for the suggestion! :)
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top