r/AskComputerScience • • Jan 24 '20

How does one actually make an API?

Hi everyone!

To clarify, I know what an API is. I use APIs. And maybe this is a super obvious question (because I can't find an answer on Google for this, only what an API is), but I for the life of me can't figure out how one would actually make an API.

For example. I have a program called Program_A. Program_A is running. I have another program, Program_B, that I want to be able to use a method in Program_A. What would I do to Program_A that would make calling it's function an API that Program_B could use?

If anyone could even give me a high level explanation that would be great, I don't really need an exact technical example (although I'm not opposed to that either). I'm just looking to understand how it works generally, because I really can't figure it out.

30 Upvotes

12 comments sorted by

View all comments

2

u/OldNewbProg Jan 24 '20

You've got a lot of good answers to your post. But I like adding my 2bits. The best way to understand it is to write one. I suggest either c# or javascript. If you use javascript, you want to look up how to write a basic nodejs api. If you use c# look up writing a .net core api.

Both should be relatively simple since you know how to use an API I assume you know some programming. If the tutorial doesn't look simple, look for a different tutorial ;) Here's Microsoft's own .net core API guide. Probably not the simplest but it's from the horse's mouth.

1

u/ConwayK9781 Feb 01 '20

Thanks for the answer (sorry for the late reply!)

Always room for two more bits when it comes to learning!

It looks like I was just expecting them to be more complicated than they really are.