Message from @Undead Mockingbird

Discord ID: 508462483472646165


2018-11-04 02:01:26 UTC  

REST means that you communicate with the server through basic HTTP messages.

2018-11-04 02:02:07 UTC  

:0

2018-11-04 02:02:09 UTC  

For example, to post a message to a Discord channel, you can just send a bunch of plain text through HTTP to the endpoint/URL and that's it.

2018-11-04 02:02:16 UTC  

o

2018-11-04 02:02:26 UTC  

All your credentials are passed as URL parameters, etc.

2018-11-04 02:02:34 UTC  

ohhh

2018-11-04 02:03:15 UTC  

kinda like how on some sites you can fill in say for example a text box with content at the same time youre loading the page by passing it through the URL?

2018-11-04 02:03:20 UTC  

So, if I had an REST endpoint, a fictional one, you could browser the URL https://api.mockingbird.com/latestupdate

2018-11-04 02:03:49 UTC  

Your browser would send an HTTP GET request, which is the same it does to retrieve the website of a regular web server.

2018-11-04 02:04:24 UTC  

But, instead of sending back HTML that your browser would display, it send you back the latest update of some news site, for example, or a MotD.

2018-11-04 02:04:44 UTC  

what do you mean an endpoint

2018-11-04 02:05:00 UTC  

An endpoint is like an URL for an API.

2018-11-04 02:05:17 UTC  

For example, the fictional URL above would be the endpoint for my fictional REST API.

2018-11-04 02:05:47 UTC  

Or, to take the example of Gab, or Minds, they have an endpoint for their API, too.

2018-11-04 02:06:23 UTC  

heh pewdiepie got shapiro to do bonus meme

2018-11-04 02:06:45 UTC  

For example, when I make a post to Minds, what my browser actually does is this:

2018-11-04 02:06:50 UTC  

i feel like i get the vague implications of what youre saying but it's all just a blur

2018-11-04 02:06:55 UTC  

https://cdn.discordapp.com/attachments/463054787336732683/508462119050543104/Screen_Shot_2018-11-04_at_3.06.29_AM.png

2018-11-04 02:07:32 UTC  

It will send the server www.minds.com an HTTP POST to the URL https://www.minds.com/api/v1/newsfeed.

2018-11-04 02:08:04 UTC  

https://cdn.discordapp.com/attachments/463054787336732683/508462407375650826/Screen_Shot_2018-11-04_at_3.07.46_AM.png

2018-11-04 02:08:22 UTC  

And this is the payload of the request, in a format called JSON, but it could be anything.

2018-11-04 02:09:09 UTC  

oooh i know JSON, that's what Minecraft uses lol

2018-11-04 02:09:16 UTC  

Then, the server sends me back a reply indicating the status of my request, like this.

https://cdn.discordapp.com/attachments/463054787336732683/508462708631404556/Screen_Shot_2018-11-04_at_3.08.40_AM.png

2018-11-04 02:09:31 UTC  

back in the days of my very first coding adventures, i did Minecraft modding

2018-11-04 02:09:46 UTC  

https://cdn.discordapp.com/attachments/463054787336732683/508462835324420096/Screen_Shot_2018-11-04_at_3.09.34_AM.png

2018-11-04 02:10:21 UTC  

And that's pretty much how REST APIs work in a nutshell. The same is true for Gab, Twitter, Facebook, Steemit, GNU Social, Mastodon, Discord, etc.

2018-11-04 02:10:35 UTC  

There are few services nowadays which don't have some kind of REST API.

2018-11-04 02:10:51 UTC  

Oh, YouTube works the same way, of course.

2018-11-04 02:11:21 UTC  

well i greatly appreciate all your effort in this explanation but its has done zero good, as i happen to just be kind of a tard

2018-11-04 02:11:47 UTC  

You already know how to program, so you are smart enough to wrap your head around it.

2018-11-04 02:12:02 UTC  

i still don't get what REST is

2018-11-04 02:12:24 UTC  

it's a buzzword

2018-11-04 02:12:31 UTC  

REST is basically just a name for calling functions over the Internet.

2018-11-04 02:13:02 UTC  

but i think my confusion roots from the misunderstanding of how exactly an API is....implemented/applied/worked with...???? idfk

2018-11-04 02:13:15 UTC  

It's using the same HTTP and URL schemas, but instead of denoting folders in a directory, for example, it encodes parameters of a call.

2018-11-04 02:13:53 UTC  

API = Application Programming Interface

It's just the name for a method through which you can invoke functionality.

2018-11-04 02:14:28 UTC  

what

2018-11-04 02:14:59 UTC  

For example, let's say you have a server.

2018-11-04 02:15:04 UTC  

you have urls, you post json to those urls, shit happens

2018-11-04 02:15:09 UTC  

tl;dr version :^)

2018-11-04 02:15:22 UTC  

Let's say, a simple Facebook. Each user has a biography and about page.