Hacker Newsnew | past | comments | ask | show | jobs | submit | digitallimit's commentslogin

In a lot of APIs I've dealt with, you can create resources with ids that match your own resources, hence wanting to use PUT for creation, e.g. if you have users in your application and you want to extend them to this web service, instead of having to store an additional "foreign key" per user, you can just PUT users in the web service with ids from your own service.

I'm doing this for the API I'm building, as modeled on FatSecret's API.


I'd appreciate other people's input on these choices. I'm currently implementing an API much in the way of these standards, but I'm almost buckling and implementing PATCH since I feel dirty having PUT do so much, so incorrectly.


You have to analyze your target audience. Will people who are new to using a restful api being using your api? Will you provide a wrapper yourself?

There are about a million questions you must ask yourself in order to come to the right answer for YOU. At the end of the day what matters is that the person using your API finds it easy and intuitive. If that means that you use PUT for updates, and POST for creation, so be it. It could even mean that you convert PUT to POST requests, and treat them all the same. If you take that route, you check to see if the resource ID is specified in the post data. If the ID is in there, you update that resource, if it's not in there you create a new resource.

While you go forward, keep in mind one thing. If your API is hard to use then no one will use it. If no one uses it, then your API doesn't matter. If your API doesn't matter, then you made all the wrong decisions.

Also, have fun with it. Creating APIs is incredibly fun, enjoy yourself, and enjoy creating something people will enjoy using.


One thing to keep in mind about wrappers is that now a days kids like accessing APIs from mobile applications. With iOS you cannot simply just wrap curl calls like you would in PHP. Developers use weird and random REST API accessing frameworks in iOS.


I would be interested in finding out more about these REST API accessing frameworks in iOS. Do you have any links?


Just off the top of my head I know of https://github.com/AFNetworking/AFNetworking, http://allseeing-i.com/ASIHTTPRequest/ (no longer supported but still used), and http://restkit.org/


Is it feasible to create subresources for each partial put? For instance, if the `/person/:id` resource has an address as part of the data, could you do PUT `/person/:id/address` to only overwrite the address?


I searched for "Hero Academy" and the first result was Google's 5th result, a site called Hero Academy with the url "hero-academy.com". That's not very "million short", IMHO.


The site removes the top million sites by popularity, not the first million results returned by a Google search. "hero-academy.com" is likely not in the top million most popular sites.


Keep me posted! (mherodev at gmail)


How does Ruby compare?


How do I install this for use on my website? I've never included fonts before, outside of the Google Web Fonts API which just asks I stick a link tag in the template.

<link href='http://fonts.googleapis.com/css?family=Oxygen rel='stylesheet' type='text/css'>



Madison, Wisconsin (http://g.co/maps/pnsev) has an imagined Monona Terrace as well as some kids with silly hats.


The region around MIT in Cambridge, MA shows similar detail: https://maps.google.com/maps?q=cambridge+ma&hl=en&ll...


I believe those denote locations of Google offices. There's also some in Mountain View.


You're just missing the stark, black and white interface.


What the hell is "Games List?"


Better yet, Draw With Friends.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: