0

What is an API in simple term ?

And some examples of API

Comments
  • 0
    @lmgtfy what is an API
  • 0
  • 1
    The public facing part of an app/class/system rhat you can hook a different application into
  • 0
    @alexbrooklyn thanks, please can you give me the tools used to build them?
  • 2
    @Afrographics

    class Hello {
    public void hello() {
    return;
    }
    }

    There you go, hello is part of the public API of this class

    But if you mean a web api, look for RESTApi frameworks for your desired language :)
  • 3
    When you write console.log(‘hello’), you use either your browser or node api

    When you go to devrant.com you use devrant web api which returns a webpage

    When you tap ++ in the app you use devrant rest api which accepts the id of the rant and returns a status code (was the operation successful or not)
  • 3
    Api is an exposed part of anything that you can interact with. Ui is an exposed part too but api is for robots and ui is for humans
  • 1
    It is for using some service without knowing how it works, you just use it from the methods they provide.
  • 1
    APPLICATION PROGRAMMING INTERFACE IS A THING THAT ALLOWS YOU TO INTERACT WITH OTHER THINGS THAT YOU NORMALLY WOULDN'T BE ABLE TO INTERACT WITH.
    WHY YOU ASK?

    WELL BECAUSE GOD IS DEAD AND SO IS HUMANITY'S ABILITY TO GOOGLE
  • 0
    Now for an actual useful answer that isn't total shitpost.

    Take a game for example.
    You are a nice developer and want to give players some degree of extending or changing up the game.
    So you set out to write a ModAPI that exposes (to a certain degree) classes, functions, values, fields, etc. That are capable of changing the game at runtime.

    An example would be

    class Player implements LivingEntitiy {

    float x,y,z; //location

    //Exposed to API
    public vec3 getLocation() {
    return new vec3(x,y,z);
    }

    ...

    }

    Now your modding class

    import com.name.game.modapi;
    class MyMod implements GameMod {

    modapi api = new modapi();

    api.initialize();

    System.out.println(api.getPlayer().getLocation());

    }
Add Comment