The elementApi docs state you can use custom elementTypes via plugins. I am using craft commerce which states it creates the custom elementType 'purchasable'
I've tried:
return [
'endpoints' => [
'category.json' => [
'elementType' => 'purchasable',
'criteria' => [
// 'category' => 'products', // randomly trying stuff here!
// 'section' => 'products',
// 'type' => 'products',
],
'transformer' => function(EntryModel $entry) {
return [
'title' => $entry->title,
'url' => $entry->url,
];
},
]
]]
I've tried many variations on the word purchasable, as we as random guesses like 'product', 'item' etc etc
I should mention I am able to JSON back with all categories, Entries etc etc
I am sure this is possible, as craft, craftcommerce and elementApi are all made by the same guys!
Any help would be amazing