spree/spree — pull request #5569 by HoyaBoya (2014-11-04 16:14:03+00:00)
Title: Make taxons in Product API # show more useful

The current taxon_ids payload in the Product GET /products/:id API is kinda hard to work with right now. By just returning IDs, it guarantees that I need to make subsequent API calls to resolve the taxon. This is due to the taxon endpoint being nested under taxonomies. This means, I need to a) Search all the taxonomies to see if it has the taxon ID, then with that taxonomy_id b) GET /api/taxonomies/:taxonomy_id/taxons/:taxon_id to find the information I need.

This change simply adds the taxons to the product JSON rail to avoid extra API calls.

Not sure about the performance about this. If it's a real bear, then perhaps the compromise is to provide taxon URLs to be lazy resolved like below. It won't get rid of the extra calls but it will make it easier to navigate the current API a bit easier.

```
{
taxon_ids: [2, 3].
taxon_urls: [
'http://somewhere.com/api/taxonomies/1/taxons/2',
'http://somewhere.com/api/taxonomies/1/taxons/3'
]
}
```