|
Ither posted:AI client? Don't get me wrong, REST is great and dumb REST clients are used every day (browsers for example), but they need an actual human to click on links and stuff to actually get anywhere. Without a human, REST APIs don't make any sense. When people say "we have a REST API", they generally mean "we have an HTTP API that may or may not look similar to REST in some ways, but probably isn't really REST". Imagine a world where people actually use REST APIs for machine clients: You need to create an app for letting your users manage ads on a sweet social network. They have a REST API, so all you get is the root endpoint - https://socialnetworkapi.com. You ask for more documentation, but they tell you that it's a proper REST API, just follow the trail of crumbs from the root URL. You start making requests to figure out what the resource tree looks like and what operations you can do on each resource. You write down all the requests you'll need for creating ads and adding pictures to them and getting stats and so on. As you submit your first pull request, the senior developer reviewing your code asks you if you're mad. "Why did you hardcode all these endpoints? It's a REST API! The endpoints can change at any time!". You go back to the drawing board and start thinking of ways to automatically navigate the API using just the root URL and HATEOAS. 50 years of hard coding go by and you finally manage to create a client that can successfully create ads on social network using a REST API. Sadly, it turns out the client is self-aware and it murders all humans. The End. sunaurus fucked around with this message at 13:04 on Apr 4, 2019 |
# ? Apr 4, 2019 12:34 |
|
|
# ? May 17, 2024 12:04 |
|
I don’t recall what the point of REST was. Resource manipulation, sure, but not everything is simple CRUD.
|
# ? Apr 4, 2019 13:11 |
|
sunaurus posted:Sadly, it turns out the client is self-aware and it murders all humans. The End. Weird place to put "Sadly" but you do you
|
# ? Apr 4, 2019 13:46 |
|
https://twitter.com/brittanybefort/status/920160913847500800 New (to me) career goal
|
# ? Apr 4, 2019 14:09 |
|
|
# ? Apr 4, 2019 14:14 |
|
Pollyanna posted:I don’t recall what the point of REST was. Resource manipulation, sure, but not everything is simple CRUD. Seems like it's a good candidate for auto generation to get basic CRUD handled to allow the programmer more space to write the interesting parts
|
# ? Apr 4, 2019 14:19 |
|
Pollyanna posted:I don’t recall what the point of REST was. Resource manipulation, sure, but not everything is simple CRUD. I don't either, so I went back to Fielding's dissertation: quote:REST emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems. I dunno. REST is about doing good design and benefiting from it, I guess.
|
# ? Apr 4, 2019 15:46 |
|
Maybe it's like the Blood Type Diet where the philosophy mostly boils down to, "Just think about what you're doing/eating literally at all and you'll feel better."
|
# ? Apr 4, 2019 16:25 |
|
Has something happened with spacebar in the past ~2 years or so? It seems like people just kind of willy-nilly started omitting spaces where they could have used them and then just dumped a few extra in other places--including between words in comments.
|
# ? Apr 4, 2019 16:47 |
|
Rocko Bonaparte posted:Has something happened with spacebar in the past ~2 years or so? It seems like people just kind of willy-nilly started omitting spaces where they could have used them and then just dumped a few extra in other places--including between words in comments. Until the most recent rev, a lot of recent MBPs had lovely fragile keyboards and the space bar was the most frequent victim.
|
# ? Apr 4, 2019 16:52 |
|
For me, REST means having an intuitive API that follows the standards that everyone understands. I constantly hit the facebook/twitter/github API as examples of good RESTful endpoints.
|
# ? Apr 4, 2019 17:13 |
|
You could argue the Facebook API works so well the data ends up literally everywhere
|
# ? Apr 4, 2019 17:33 |
|
Sagacity posted:You could argue the Facebook API works so well the data ends up literally everywhere Data just wants to be free.
|
# ? Apr 4, 2019 17:43 |
|
poemdexter posted:For me, REST means having an intuitive API that follows the standards that everyone understands. I constantly hit the facebook/twitter/github API as examples of good RESTful endpoints. What are the standards that everybody understands?
|
# ? Apr 4, 2019 17:45 |
|
Pollyanna posted:What are the standards that everybody understands? Depends how do you define "everybody" and "understands".
|
# ? Apr 4, 2019 18:05 |
|
Subjunctive posted:Until the most recent rev, a lot of recent MBPs had lovely fragile keyboards and the space bar was the most frequent victim. Pollyanna posted:What are the standards that everybody understands?
|
# ? Apr 4, 2019 18:23 |
|
Pollyanna posted:What are the standards that everybody understands? Do what github/facebook/twitter does with respect to endpoint definitions and response codes. That's really all that matters to me.
|
# ? Apr 4, 2019 19:24 |
|
Pollyanna posted:I don’t recall what the point of REST was. Resource manipulation, sure, but not everything is simple CRUD. Its easier to talk to than SOAP What I get out of REST: you can test with a simple html client. That's about it.
|
# ? Apr 4, 2019 20:29 |
|
Zaphod42 posted:Its easier to talk to than SOAP You mean http client like curl? I can’t think of an html client that makes PATCH or DELETE easy.
|
# ? Apr 4, 2019 21:18 |
|
poemdexter posted:For me, REST means having an intuitive API that follows the standards that everyone understands. I constantly hit the facebook/twitter/github API as examples of good RESTful endpoints. All our APIs follow the same structure: every request is a POST, request body is some object specific to the type of request, and response body has a Succeeded, ErrorCode, ErrorMessage and Result field, which contains the actual response data. Want to create a Foo? POST to api/V1/CreateFoo with a CreateFooRequest json body, get back Succeeded=1, ErrorMessage=null, Result = { CreatedFooId = 1 } Want to get a Foo? POST to api/V1/GetFoo with a GetFooRequest body { FooId = 1 }, get back a GetFooResponse in the Result field Want to frobnicate a Foo? POST to api/V1/FrobnicateFoo with a FrobnicateFooRequest body, e.g. { FooId = 1, FrobnicateType = … }, get back your result. Every request should always get back a 200 response, so you don't need to know if your error code was because the service broke or it was trying to return you a logical error via HTTP status codes. If you get a 404, your request is broken, anything else means the server barfed. Nobody needs to think about which HTTP verb to use for a particular request, and nobody needs to think about what each HTTP status code might mean. Not entirely sure if this belongs in the coding horrors thread instead
|
# ? Apr 4, 2019 21:37 |
|
You've essentially reinvented a worse version of gRPC then
|
# ? Apr 4, 2019 22:01 |
|
Hughlander posted:You mean http client like curl? I can’t think of an html client that makes PATCH or DELETE easy. Yeah http. Curl or postman.
|
# ? Apr 4, 2019 22:42 |
|
Sagacity posted:You've essentially reinvented a worse version of gRPC then Nothing wrong with a little RPC.
|
# ? Apr 5, 2019 03:37 |
|
redleader posted:Nothing wrong with a little RPC. Everything's wrong with a little reinvention though.
|
# ? Apr 5, 2019 03:41 |
|
Hughlander posted:You mean http client like curl? I can’t think of an html client that makes PATCH or DELETE easy.
|
# ? Apr 5, 2019 03:44 |
|
Munkeymon posted:https://twitter.com/brittanybefort/status/920160913847500800 This happened at one of my previous gigs. "I QUIT" on a cake. She had to keep trying to keep her coworkers (self included) from eating it until her boss arrived to read it.
|
# ? Apr 5, 2019 04:30 |
|
Jeez, just flip it onto the scanner bed so that you can print a copy.
|
# ? Apr 5, 2019 05:04 |
|
Just arrive late to work, what are they going to do, fire you?
|
# ? Apr 5, 2019 05:06 |
|
Seat Safety Switch posted:This happened at one of my previous gigs. "I QUIT" on a cake. She had to keep trying to keep her coworkers (self included) from eating it until her boss arrived to read it. That's epic. I'm stealing that idea.
|
# ? Apr 5, 2019 11:57 |
|
Zaphod42 posted:Yeah http. Curl or postman. I have an unreasonable hate for postman which stems from the time as a tester. Like Cyprus it gives people another tool to do a specific thing and then locks them in this really weird interface that allows very incompetent people to build very complex things that are unmaintainable by modern standards defeating the entire purpose of tooling to begin with. However, since I discovered it to do some simple calls to check if my service is running properly deployed with everything connected, I like it more. And it spits out and accepts Curl commands for easy sharing. So yeah, postman, sounds like a plan.
|
# ? Apr 5, 2019 13:15 |
|
I get your point, but GUI or not incompetent people will gently caress something up inevitably anyway. That's why we're all lucky enough to be able to afford booze.
|
# ? Apr 5, 2019 15:20 |
|
beuges posted:All our APIs follow the same structure: every request is a POST, request body is some object specific to the type of request, and response body has a Succeeded, ErrorCode, ErrorMessage and Result field, which contains the actual response data. Dear god that's so close to what some people are designing here. I'm so triggered.
|
# ? Apr 5, 2019 15:46 |
|
beuges posted:All our APIs follow the same structure: every request is a POST, request body is some object specific to the type of request, and response body has a Succeeded, ErrorCode, ErrorMessage and Result field, which contains the actual response data. It's all bad, but anyone who puts an HTTP verb in the name of an api (e.g. GetFoo instead of having Foo with a GET verb) should be loving stabbed. I hate that poo poo.
|
# ? Apr 5, 2019 15:53 |
|
GetFoo doesn't accept GET, sorry, you gotta HEAD
|
# ? Apr 5, 2019 15:54 |
|
poemdexter posted:Dear god that's so close to what some people are designing here. I'm so triggered. I don't normally code in this kind of domain, but I feel like that example is more than half of how internally-facing web applications are probably implemented.
|
# ? Apr 5, 2019 16:05 |
|
Things that matter, in order:
Things that don't matter:
beuges posted:All our APIs follow the same structure: every request is a POST, request body is some object specific to the type of request, and response body has a Succeeded, ErrorCode, ErrorMessage and Result field, which contains the actual response data. Assuming the documentation is up to snuff, this is a good API.
|
# ? Apr 5, 2019 16:40 |
Kevin Mitnick P.E. posted:Things that matter, in order: lol tell this to my company. The list is backward (also consistency isn't on the list)
|
|
# ? Apr 5, 2019 17:20 |
|
Kevin Mitnick P.E. posted:
Thanks. Finally some validation to make my next api use only OPTIONS requests. Good luck, browsers.
|
# ? Apr 5, 2019 17:23 |
|
Kevin Mitnick P.E. posted:Things that matter, in order: How does it feel to be so wrong?
|
# ? Apr 5, 2019 17:24 |
|
|
# ? May 17, 2024 12:04 |
|
I'm spending far too much time trying to figure out what URL a certain API endpoint should live on. The request is going to be "get me the permissions user X has on application Y," so both X and Y definitely need to be in the URL, but I'm not planning to allow "get me all permissions user X has" or "get me all users application Y has," so I'm probably overthinking it and should just use /permissions?user=X&application=Y instead of the typical RESTful hierarchical-ish style. I'm Not Gonna Need It™
|
# ? Apr 5, 2019 17:27 |