refinerycms-contrib / refinerycms-api

Refinery CMS Rest API extension
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

Find why i can't upload a new resource by the Rest API #3

Open bricesanchez opened 8 years ago

bricesanchez commented 8 years ago

A message from @simi:

Hello @bricesanchez!

This is because you expect @resource in template, but only array of @resources is defined in controller.

I'm not sure how to handle this in returned views, but now you're returning only last image for example hence multiple images was created. Images works only because @image is defined in controller.

Probably you'll need to use separate views for show and create (just array of show view) to return list of created resources for create action.

simi commented 8 years ago

If you'll tell me what's expected output I can help you here.

bricesanchez commented 8 years ago

I would like the same feature of the CMS

simi commented 8 years ago

But what does it mean? In refinery when you create resource you're redirected to resources list. But here in API you can create multiple resources, so I think it will make sense to return array of all created resources in JSON. Same stands for images. WDYT?

bricesanchez commented 8 years ago

First step is to be able to create 1 resource with the API but if we can directly handle multiple resources, it will be great. So it make sense to return an array.

Feel free to provide a PR, i love to merge them :D