I don't understand how most APIs work

I'm late as hell, but as someone who didn't understand APIs until I did it, I'll try to offer my help.

  • Certain APis are language specific, my reddit bot is in Python, it transcodes to C#, but the bulk is in Python because reddit IS python. The non language specific ones are still "preferred language" but you can call them in other languages. That gets dicey

  • No, not at all. Could I make a C# program that interacts with a C API? Sure, but it'd be hard, and difficult and the best mathematician is a lazy one.

  • JSON is basically pulling all the info at once, it's brute force but it works. It'd be similar to pulling a whole hard drive to find one word doc. That's a really heavy handed analogy, but in the web scene that's kind of what it's like. You only do it it if you have no other option. It's not bad, don't think that, just not where most web programmer start.

  • Oddly enough Reddit's API is dead simple and straightforward as can be. I've written two bots for my personal use. You need to know python but you import the library and then you use the functions as you would normally. GetPost()(sic) works just like if you had written it. Reddit bots are simple as hell. Just make sure to add a Wait or you'll get flagged.

  • They "make their API", for example, in terms for cyrpto, the Twitch paradigm works off a public/private key. If you want to program something that runs with their server you have to get a "private key" and add it to your API. Reddit works the same way. It works, the API, if it's designed to spec won't let unsecured connections connect with secured ones, but it's pretty easy to get auth.

  • In most cases it's a class if you're from C/C++/C#/Java or a library if you're from Python/Ruby/LUA. It integrates seamlessly in most cases. You use the API's functions just like you would your own, like it's a class/library, call the function and go. They have their own pass variables/conditions/wtfC&C++ use pointers?

I'd suggest you dive in, especially with reddit, since that API is python and well documented. I have two reddit bots running right now. They don't post or anything like that, it's all datascrape for my personal use. But iff I wanted them to post it's 3 lines of code because of the API.

/r/learnprogramming Thread