C
C#15mo ago
wwww

✅ REST Api

Hi, so I just want to learn what a REST API and JSON API are. When I Google it, I come across some weird websites. Of course, they might have everything about those things, but anyway, can someone concisely explain what these are and provide some sources to dive deeper into that. Maybe I already understand what this is, but I'm not very familiar with the terminology in this case. is it about HttpContext and it's methods, middlewares, routing, services etc?
6 Replies
Angius
Angius15mo ago
API stands for Application Programming Interface, it's a way for two different pieces of software to talk to eachother A web API is such an API accessible on the web A Json API would be one that returns and takes Json data, and not XML or binary And REST is a set of rules and guidelines talking about how to "best" implement a web API
wwww
wwwwOP15mo ago
I thought it was something more complicated, like more than what I've learned in ~15 days. It feels l imposter syndrome cuz these things in asp.net core seem super easy (after 5 monthss of C# with algorithms, some low level things and ~300 leetcode solutions). Of course, putting everything together and make it work is not an easy task. but separatly this things are super easy to understand, im i wrong?
Angius
Angius15mo ago
I mean, yeah, making an API with ASP.NET Core is super easy
record Input(string Name);
record Output(string Welcome, int Random);

app.MapPost((Input input)
=> new Output($"Hello, {input.Name}", Random.Shared.Next()));
record Input(string Name);
record Output(string Welcome, int Random);

app.MapPost((Input input)
=> new Output($"Hello, {input.Name}", Random.Shared.Next()));
and done. Send a
{
"name": "Bob"
}
{
"name": "Bob"
}
payload and you get
{
"welcome": "Hello, Bob",
"random": 9
}
{
"welcome": "Hello, Bob",
"random": 9
}
back Easy as pie And, true, all individual components are fairly easy to grasp But when the scope and complexity of a project grows, the biggest problem becomes how to make it all work together
wwww
wwwwOP15mo ago
Up to me, it's something you can only learn with real cases. theres no way an someone entry level can handle that in 2023, like, thats job for guys from a bit higher league, isn't it?
Angius
Angius15mo ago
Yeah, it certainly comes with experience Not something you can learn by doing leetcode and watching youtube tutorials Not necessarily something you can learn at school or college either
wwww
wwwwOP15mo ago
Thanks for the great answers as always badhun1UA
Want results from more Discord servers?
Add your server