Question Online APIs (JSON)

Discussion in 'General Help' started by DoggyCode™, Oct 26, 2015.

?

Have you used Mojang's Web API before?

Poll closed Nov 2, 2015.
  1. Yes

    50.0%
  2. No

    50.0%
  3. I tried it... once...

    0 vote(s)
    0.0%
  4. I'm out!

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. Offline

    DoggyCode™

    Hey, I've been searching around now for a couple of good hours, and I can't seem to find anywhere to learn how to use Online APIs.

    What do I mean by this?
    Let me just tell you what I want this for--
    For my plugin I would want to access Mojang's online API: http://wiki.vg/Mojang_API and use JSON information gathered from there in my plugin.

    For example
    Player types '/whoreallyis PvPdog', I would then return a message using information gathered:
    "PvPdog's UUID is: StringUUID - Gathered from: https://api.mojang.com/users/profiles/minecraft/pvpdog?at=0"
    or
    "PvPdog's UserID is:
    c80447557a0c4e77b8eae1b2802a0ea0 - Gathered from: https://sessionserver.mojang.com/session/minecraft/profile/c80447557a0c4e77b8eae1b2802a0ea0 UUID
    "

    If you still don't understand, please let me know!
     
    Last edited: Oct 26, 2015
  2. Offline

    DoggyCode™

    No replies?

    BUMP
     
  3. Offline

    Lolmewn

    Just request it using a HTTP GET request.
     
  4. Offline

    DoggyCode™

    Thank you for that, @Lolmewn , ok, let's say I have requested it, now how to I gather the information, let's say put it in a String from JSON?

    Ex:

    String s = gatheredJSONInfo_ID;
     
  5. Offline

    Lolmewn

    @DoggyCode™ You're going to have to look up the JSON documentation for that.
     
  6. Offline

    DoggyCode™

    Alright...

    To anyone else: if you have any useful information, throw it at me. I tried looking for JSON examples as well, I found some, but none of them included getting the JSON information from HTTP clients (websites)
     
  7. Offline

    Lolmewn

    @DoggyCode™ Psst: This is also included in the Updater lib, which can be found on these forums under libraries.
     
    DoggyCode™ likes this.
  8. Offline

    teej107

    Just retrieve the String from the site and then parse it into a JSONObject. It's part of json-simple and it is already packaged in with the Bukkit API
     
    DoggyCode™ likes this.
Thread Status:
Not open for further replies.

Share This Page