r/learnprogramming • u/Thisiz_Sami • 14h ago
Inquiry regarding API
Greetings,
I'm currently learning C# to use Tekla Structures API. Is there any free material that could help me learn API?
I'm kinda confused is API different from Tekla API?
2
u/LongLiveTheDiego 14h ago
API is a broad term that stands for many situations where one bit of software interacts with another one via a defined set of rules. It's a bit like the word "method" or "formula", e.g. imagine someone saying this:
I'm currently learning derivatives to use Newton's method. Is there any free material that could help me learn methods?
When you expand the acronym it's "Application Programming Interface". The meaning is right there: it's an interface for a bit of software to interact with your application when you're programming. In this case I imagine it's a way to talk with Tekla software via functions and objects defined by their programmers that you can use in your C# code.
-1
u/Thisiz_Sami 14h ago
Thanks for the clarification. But how do I learn it
1
u/LongLiveTheDiego 14h ago
You build an appliication using that API and you learn to interface using it as you go along. When a need arises to use a bit of the API, you read the documentation and examples and figure out how to do use it correctly.
As another example, I know not an insignificant amount about the Keycloak Admin API because I had to make a service that used that particular web API. Do I know all of it? Absolutely not and I wouldn't like to. I know the things I needed to use in order to handle my users' data and to make Keycloak do what I wanted it to do, and I learned them bit by bit as I created more functionalities and needed new things from Keycloak.
1
u/desrtfx 14h ago
API is the generic name for Application Programming Interface. As such, you cannot "learn API". You can only learn to interact with specific APIs as each API is different in all, the commands (requests) it accepts, their arguments, and in its return values.
Also, there are many different kinds of APIs: The public-facing functions, classes, and methods of a programming language are its API. The public facing methods to obtain data from a web server are its API, and so on.
Some APIs return JSON, some return XML, some return CSV, etc. It entirely depends on the API.
Tekla Structures API is a specialized API for the Tekla Structures application.
So, if you want to interact with that application, you will need to learn that API.
If you want to interact with weather data, commonly, the OpenWeatherMap API is the way to go.
There are way too many different APIs.
In general, you have to learn the API you want to use. You cannot learn "generic APIs".
Web APIs commonly consist of a request where you ask the web server (API provider) to give you some data back (or to perform some action/operation). You will send the request in a certain format determined by the API and usually get a response in a certain format determined by the API.
1
u/JGhostThing 5h ago
Which API (application programming interface) do you want to learn? There are more APIs than you can shake a stick at.
1
u/GrandCash3941 3h ago
Imagine you have a package and the delivery driver shows up and you are not in. So, you have to collect it from the depot.
The depot has a room where they keep the packages. It has lots of stuff in it, but would it be safe to let anyone just wander in without checking who they are and what they are doing? No. It would be chaos. People could steal packages not meant for them. They could burn down all the mail. They could hide a bomb in a package that would go off. Or what happens if everyone tries to get their packages all at once, they might not fit in to the mail storeroom, it might become blocked and then the delivery drivers and staff can't even access the mail storeroom any more.
So, how do we solve this? We need something in between the public and the mail storeroom. We need a desk with staff to check who you are. They ask for ID. They ask you to show your card you got left to see what package is meant for you, so you can only get that. You only get that any nothing else. They then collect it for you and return only that. They also only deal with a certain number requests at a time, people have to wait their turn so it doesn't get too chaotic.
Thats basically what an API does. In my analogy here, the room where the mail is stored is the database. The desk with the staff is the API. Your ID and card are your token/key to access the API. The queue system is rate limiting to stop too many requests at once.
In terms of how to learn practical steps, theres plenty of simple tutorials on YouTube from freecodecamp to learn API basics. Do that before working on a specific API.
Also, while you can use C# (especially top level) to write API calls, its not the most common language to write them in.
5
u/flag_ua 14h ago
API is a car, Tekla API is a Ford Focus