|
I agree, don't send back URLs. You should have a well defined data layer which handles creating routes, so if you are going to fetch spouse #3, you call data.getSpouse(3). Blindly fetching URLs told to you by a backend service sounds like a disaster waiting to happen.
|
# ? May 18, 2017 00:28 |
|
|
# ? Jun 1, 2024 04:57 |
|
Roy Fielding, the inventor of REST API's would disagree. So would Martin Fowler. keyword: HATEOAS (that being said, I'm lazy and rarely developing something that anyone will care about in a couple years so I usually just send back IDs)
|
# ? May 18, 2017 00:51 |
|
Thermopyle posted:Roy Fielding, the inventor of REST API's would disagree. So would Martin Fowler. RESTish? I've never thought of REST being a concrete set of rules, but general guidelines that are flexible to what you need.
|
# ? May 18, 2017 01:53 |
|
Thermopyle posted:Roy Fielding, the inventor of REST API's would disagree. So would Martin Fowler. If you only send back IDs and something changes, every client must re-write code. If you send a URL, you don't. There is no reason you can't also send a list of IDs.... but then you probably aren't by the book REST. That said, when I write an API, I too am lazy and only send IDs.
|
# ? May 18, 2017 02:18 |
|
I don't have a strong opinion one way or another. I guest the numbered list is easier to parse [1,54,2,7,5]. Simple is better than complex. It probably matter has much than this "decision" how well documented is and that is consistent to how the same api do things in other areas.
|
# ? May 18, 2017 08:25 |
|
Lumpy posted:If you only send back IDs and something changes, every client must re-write code Could you elaborate on this?
|
# ? May 18, 2017 19:33 |
|
You'd have to rewrite any API call if the URL changes to account for it. Unless you keep all that info in a constants file and import them into any API call, then it would only require a change in one place.
|
# ? May 18, 2017 19:43 |
|
ROFLburger posted:Could you elaborate on this? If one of your endpoints is, say, https://api.butts.com/butts/1/farts/, if you want to change to https://api.butts.com/api/v1/butts/1/farts/ or anything else then you will have to update all the clients to add the /api/v1/ bit. And there's the problem that not all clients for your API will be under your control to change that constant. If you were sending the URLs in the responses then the work just needs to be done server side. Space Kablooey fucked around with this message at 19:51 on May 18, 2017 |
# ? May 18, 2017 19:48 |
|
I don't know why anybody would want to send the whole url. But I guest theres a strategy to it. Maybe is to make some sort of sacrifice to autodocumentation? [1,3,4,5] seems simple enough for me.
|
# ? May 18, 2017 19:51 |
|
ROFLburger posted:Could you elaborate on this? Why yes, I'd love to: HardDiskD posted:If one of your endpoints is, say, https://api.butts.com/butts/1/farts/, if you want to change to https://api.butts.com/api/v1/butts/1/farts/ or anything else then you will have to update all the clients to add the /api/v1/ bit. And there's the problem that not all clients for your API will be under your control to change that constant.
|
# ? May 18, 2017 19:52 |
|
Tei posted:I don't know why anybody would want to send the whole url. I just linked the page you should read about the subject.
|
# ? May 18, 2017 19:53 |
|
Lumpy posted:Why yes, I'd love to: Which can be summarized as Lumpy posted:If you only send back IDs and something changes, every client must re-write code. If you send a URL, you don't.
|
# ? May 18, 2017 19:55 |
|
Why not provide both? Disclaimer: I have never written an API but interact with them a whole lot.
|
# ? May 18, 2017 19:56 |
|
kedo posted:Why not provide both? Disclaimer: I have never written an API but interact with them a whole lot. You could, but the question is why would you?
|
# ? May 18, 2017 19:58 |
|
Man, there are so many people on software that want to make things complex. I like simple things. They themselves grown to complex, but then are still manageable. But if you start complex, then what?
|
# ? May 18, 2017 20:20 |
|
Returning URLs should not be any more complex than returning a list of ids, with the trade off that clients are simpler to build (they only parse the relevant fields and make the requests). Conversely, returning a list of ids is also simple, but now the clients have to, in addition to parsing the fields, manage the endpoint URLs and also build them before making the requests.
|
# ? May 18, 2017 20:32 |
|
Something I don't like about returning URLs is that you lose some flexibility. What if I want to use the children to act on some other resource using each child's ID? I need to either parse the URL and try to extract the ID, or I have resolve each URL individually
|
# ? May 18, 2017 21:15 |
|
ROFLburger posted:Something I don't like about returning URLs is that you lose some flexibility. What if I want to use the children to act on some other resource using each child's ID? I need to either parse the URL and try to extract the ID, or I have resolve each URL individually Maybe I'll be a nice API implementer and accept URLs as child IDs. Hell, maybe that'll be all it accepts as a child ID.
|
# ? May 18, 2017 21:30 |
|
HardDiskD posted:You could, but the question is why would you? I can see arguments for doing it either way, tbh. As someone using the API, I want to make sure my code isn't going to break because someone decided to update the API. Therefore maybe URLs are better because if they're updated to use a different format my code will keep working and I won't even notice. Then again, if I have a lot of different ways to run queries against the API and the URL isn't going to be stable, I'd rather have the ID. That way I can keep the URL as a variable in my code and update it as needed as the URL changes. So why not provide both? I mean... if I'm getting an object from an API I expect to get an ID by default. I might also expect to get URL-like things (permalinks? aliases?). Neither of them seem out of the ordinary. I realize using both bloats things a little bit, but it doesn't seem like it'd bloat things too much. Anywho, did I mention I know nothing about writing APIs? :P kedo fucked around with this message at 23:21 on May 18, 2017 |
# ? May 18, 2017 23:17 |
|
When I normalize incoming data i parse out the ids and keep both the url and the id for later use.
|
# ? May 18, 2017 23:19 |
|
TBF the REST API I'm implementing is a small personal project. It's not exactly a toy project but it's not what I would call big in any way. I've used APIs that returned ids and they were fine, and I dabbled in a few APIs that returned URLs, namely Facebook's and Youtube's, and they were fine as well. The arguments that I've seen for using URLs sounded good to me, and the little practice I'm having while implementing URLs APIs made them feel better than the alternative already. Even then I can't really talk about their pros and cons too much because I'm still learning what makes them tick. Having said that, I think returning both ids and URLs is mistake, but I can't really articulate why beyond that I feel it's just redundant info. In addition to that, I also think that if the API returns URLs and a client still needs to parse the URLs then something has gone terribly wrong in the API architecture.
|
# ? May 18, 2017 23:52 |
|
I've recently been getting into React and React-Native and was wondering if anyone could share some good guides/tutorials for it.
|
# ? May 20, 2017 02:46 |
|
Create-react-app, the lynda.com tutorial, and the codeacademy courses are the go-to things i recommend. Oh and obviously the documentation
|
# ? May 20, 2017 02:57 |
|
I had an easier time learning by focusing on functional components, with state existing at a high level. Ie keep your state outside the components, (You could start with a global object or Map, or dive right into something like Redux) pass it to a top-level component, then pass what you need to sub-components as props.
|
# ? May 20, 2017 08:53 |
|
This is driving me crazy, maybe someone here can help. I've got a site that displays a the site font smaller Google Chrome browser than anywhere else. When I push the code up to Github or look at my localhost in Firefox, Safari, everything's fine. For that reason I don't think the problem is my code per say but some Chrome feature that's misbehaving... but only for my local run of it. I'm not seeing this issue with any other site, and yes, I'm viewing the tab in Actual Size. I'm wondering if anyone has seen this sorta thing before and can point that it's either: - A special setting of Chrome that handles rem values differently... but only for locally run code, - Does localhost default to using local fonts now for some reason? Maybe there's differences in the google font vs. local one.
|
# ? May 20, 2017 16:16 |
|
Question for you guys: In the game makin' world, they have these game jam things for people like me who aren't good enough to make something completely on their own yet or for people who want to be in groups to help motivate them to finish a thing. Is there anything like that which I could get in on? Sort of like a web jam or whatever? Because there isn't exactly a place for people to come together and work on stuff in groups and get experience under their belts afaik.
|
# ? May 20, 2017 17:37 |
|
I've heard of a few before, though they tend to be web-app oriented as opposed to traditional websites. I have a buddy who does them all the time, I'll ask for some recommendations. The buddy in question is a design/ux guy with antiquated coding chops, so I think there's a place for all skill sets/levels.
|
# ? May 20, 2017 18:42 |
|
it's also not too difficult or expensive to just try building your own website using something like amazon web services or some other web host. Like, sure, it will cost you a little bit, but if you're serious about learning, it's not a large expense.
|
# ? May 20, 2017 18:44 |
|
No one answered my Q here, but it was definitely Chrome loading my local version of the font instead of the one from Google Fonts. I ended up fixing it by just loading the font locally on the site via a .Woff intsead. Unsure if that's gonna punish the load time at all, but I haven't found a browser it differs in yet, so *yay*.
|
# ? May 22, 2017 17:54 |
|
EatinCake posted:No one answered my Q here, but it was definitely Chrome loading my local version of the font instead of the one from Google Fonts. I am not a expert but... Not using a CDN adds a linear time to load resource. So if your website is in usa, in europe the load time per resource can be 200 ms/slower. In asia it can be 500 ms slower (numbers pulled from my rear end). CDN makes sense if you want your website to feel snappy and have users around the world. But if your resource is usa only or something like that, I don't think you "need" a cdn. Of course, maybe cdn's help with load if your website show in the news, and you have a spike of 3000 visitors in 20 minutes so more people load something, instead of a timeout error.
|
# ? May 22, 2017 18:05 |
|
Use a CDN with a local fallback - best of both worlds.
|
# ? May 23, 2017 07:49 |
I'm looking to create a RESTful API, which will allow me to login users using their LinkedIn and Facebook profiles. It looks like I will need to implement OAuth2 authentication. My goal is to consume this API as the back-end for C# Web MVC projects as well as mobile development projects. Any suggestions as far as a language to use and/or useful guides or tutorials to follow? I thought Java might be a good choice so that it will integrate easily with Android projects, but then I realized that my web host can't run Java. Maybe C# is the way to go and host the API on Microsoft Azure? Then I can use the API for Xamarin apps and ASP.NET MVC? Any suggestions are welcome, I am a beginner as far as developing my own APIs. I've created basic SOAP services with Java as well as WCF with C# in the past, but I'm not sure the best technologies to achieve my goal for this project.
denzelcurrypower fucked around with this message at 16:40 on May 23, 2017 |
|
# ? May 23, 2017 16:33 |
|
Ornithology posted:I'm looking to create a RESTful API, which will allow me to login users using their LinkedIn and Facebook profiles. It looks like I will need to implement OAuth2 authentication. My goal is to consume this API as the back-end for C# Web MVC projects as well as mobile development projects. Any suggestions as far as a language to use and/or useful guides or tutorials to follow? I thought Java might be a good choice so that it will integrate easily with Android projects, but then I realized that my web host can't run Java. Maybe C# is the way to go and host the API on Microsoft Azure? Then I can use the API for Xamarin apps and ASP.NET MVC? Any suggestions are welcome, I am a beginner as far as developing my own APIs. I've created basic SOAP services with Java as well as WCF with C# in the past, but I'm not sure the best technologies to achieve my goal for this project. Microsoft already did all of the hard work for you and you can basically get OAuth2 working with Facebook, Google, Twitter and Microsoft by editing credentials for each service into a file in a project template: https://docs.microsoft.com/en-us/aspnet/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on I did that for a toy project last year and the hardest part was getting all of the 3rd party credentials set up.
|
# ? May 23, 2017 17:14 |
Munkeymon posted:Microsoft already did all of the hard work for you and you can basically get OAuth2 working with Facebook, Google, Twitter and Microsoft by editing credentials for each service into a file in a project template: https://docs.microsoft.com/en-us/aspnet/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on Is that for hosting a web service though? It seems like it's just for setting up a web application, but I'm looking for a tutorial which integrates this authentication into a RESTful API service. Forgive me if it's a foolish question, I'm new to the topic. e: I think this link describes what I need, can anyone comment if it looks like it will serve my purpose? https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/individual-accounts-in-web-api denzelcurrypower fucked around with this message at 20:44 on May 23, 2017 |
|
# ? May 23, 2017 19:56 |
|
Does anyone know the name(s) of some of the nice, big, free icon sets that currently exist? I'm specifically for a set of icons that indicate counting on one's fingers (ie, icons with 0, 1, 2, 3, 4, and 5 fingers up), ideally in a scalable format. Better yet would be an animation of the fingers being raised, but that's less likely to be kicking around somewhere.
|
# ? May 24, 2017 02:11 |
|
Ornithology posted:Is that for hosting a web service though? It seems like it's just for setting up a web application, but I'm looking for a tutorial which integrates this authentication into a RESTful API service. Forgive me if it's a foolish question, I'm new to the topic. Yeah, that's a guide to how ASP.NET's Identity features work over a RESTful service. The one I linked to was more of a setup guide.
|
# ? May 24, 2017 13:55 |
|
Newf posted:Does anyone know the name(s) of some of the nice, big, free icon sets that currently exist? I'm specifically for a set of icons that indicate counting on one's fingers (ie, icons with 0, 1, 2, 3, 4, and 5 fingers up), ideally in a scalable format. Better yet would be an animation of the fingers being raised, but that's less likely to be kicking around somewhere. This one is huge, but according to wikipedia it has all the ASL icons in it, so that might include counting: https://sourceforge.net/projects/openiconlibrary/
|
# ? May 24, 2017 18:58 |
Munkeymon posted:Yeah, that's a guide to how ASP.NET's Identity features work over a RESTful service. The one I linked to was more of a setup guide. The one you posted doesn't appear to be for a Restful service which is what I was looking for! The one I posted has examples of regular authentication, but it doesn't show how to authenticate with third parties like Google or LinkedIn! Very irritating that the documentation does not cover the topics listed in the title/subtitle.
|
|
# ? May 24, 2017 19:59 |
|
I have limited Design knowledge and found myself working on some CSS-related issues on my web application when I came across a lot of syntax I've never seen in CSS before. I looked it up and found they're called "At-rules". Seem pretty cool/powerful, but I'm a little confused on some stuff. For example, here's the @media at-rule. It lists "-webkit-device-pixel-ratio" however my CSS file uses "-webkit-min-device-pixel-ratio". So why/how does that work? And furthermore, on that page below the list of Media Features they provide some examples, one of which is for the min device pixel ratio. But it's also colored in green on their example which typically implies a comment, although I'm going to assume it's just an issue with how they mark up code blocks. Lastly, is there somewhere better than MDN for JavaScript and CSS APIs? Like I said I generally don't do much design work -- and while I do use JS plenty I don't often "do new things" that require much more of me than a cursory search of StackOverflow. Any time I do use their site I'm typically happy with the information but the CSS stuff seems to be lacking a lot of Browser Support/Compatibility information. Sab669 fucked around with this message at 17:27 on May 25, 2017 |
# ? May 25, 2017 13:05 |
|
|
# ? Jun 1, 2024 04:57 |
|
[oh, you was asking something different. I misread] Tei fucked around with this message at 13:38 on May 25, 2017 |
# ? May 25, 2017 13:32 |