News for hackers. Stuff that matters.
Re:Show HN: SWAPI – A Star Wars API by mcphage on Friday December 05, 2014 @09:31AM (#8704642)
Can I use the API to figure out that, for instance, the x-wing is /vehicles/1 and Mustafar is /planets/7? Otherwise, how would I know?
Re:Show HN: SWAPI – A Star Wars API by paulhallett on Friday December 05, 2014 @09:34AM (#8704662)
As well as ID, we'll do some fuzzy matching on the URLs as well, so

GET /api/vehicle/t-65-x-wing

and

GET /api/planets/mustafar

will also work

Re:Show HN: SWAPI – A Star Wars API by anonfunction on Friday December 05, 2014 @10:46AM (#8705050)
I think it would be nice to also provide an endpoint that lists all the resources as an array of objects where the key is the id and the value is the name. Maybe something like this:

  GET /resources/ships
  [
    { 1 : "Tantive IV" },
  ]
Re:Show HN: SWAPI – A Star Wars API by paulhallett on Friday December 05, 2014 @10:51AM (#8705072)
So RESTfully, I think this is normal. You should be able to call a resource and then be fed back all of those resources (usually paginated to say, 20 per request).

It will have this style of lookup.

Re:Show HN: SWAPI – A Star Wars API by svsaraf on Friday December 05, 2014 @11:30AM (#8705296)
Do you mind discussing how you did the fuzzy matching?

My initial guess would've been dynamic programming (levenstein distance), but if this is API-wide, did you make a suffix tree?

Re:Show HN: SWAPI – A Star Wars API by lttlrck on Friday December 05, 2014 @10:46AM (#8705047)
This doesn't work on pokeapi.co
Re:Show HN: SWAPI – A Star Wars API by paulhallett on Friday December 05, 2014 @10:50AM (#8705066)
PokeAPI is getting an update - http://phalt.co/if-you-have-data-they-will-consume-it/

and it will have better fuzzy matching.