Skip to content

Instantly share code, notes, and snippets.

@PimDeWitte
Created July 12, 2017 00:39
Show Gist options
  • Save PimDeWitte/f46785c267f45e0bf12305b8d68ababa to your computer and use it in GitHub Desktop.
Save PimDeWitte/f46785c267f45e0bf12305b8d68ababa to your computer and use it in GitHub Desktop.
Hi everyone, here are some example calls for Medal. All response are given in JSON only. We will add more functionality soon (such as being able to upvote inside discord, submitting clips, and seeing results from a specific discord channel. For now you'll have to use MedalBot for these features.)
1) Get started by syncing your local games with ours. You can do this by syncing with our categories endpoint.
For example: Do a request to https://api.gomedal.com/categories and you'll receive a JSON array of categories like this:
https://pastebin.com/sp5ND2sF
Simple save the categoryName and the categoryId to a local array and save it. You'll need it later.
2) After you've synced the games, you can request trending clips. This is how it works:
Send a GET request to https://api.gomedal.com/botclips
Here are some examples:
Return 1 random clip (useful for .randomclip command):
https://api.gomedal.com/botclips?random=true
Return 1 random PUBG clip (useful for .randomclip command):
https://api.gomedal.com/botclips?random=true&categoryId=41
Return the top 10 PUBG clips of that day:
https://api.gomedal.com/botclips?categoryId=41&limit=10
Note here that 41 is the categoryId that you also used when you synced your games with ours. This way, if a user types ".topclips PUBG" you can check which categoryName matches with the user input (and maybe write some exceptions) and assign the right categoryId.
Return the global top 50 of that day
https://api.gomedal.com/botclips?limit=50
It returns a JSON object with a "clips" JSON array like this:
https://pastebin.com/hZq45pm8
This should be everything you need to implement .random
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment