/blog/2015/04/how-to-use-a-cakephp-3-rest-api/ #154
Replies: 21 comments 32 replies
-
Mark Scherer [DISQUS]: It might be worth mentioning https://github.com/UseMuffin/Throttle and the Throttle DispatcherFactory to manage the amount of hits to your API if you need that. |
Beta Was this translation helpful? Give feedback.
-
avinashjoshi [DISQUS]: I'm not sure if this has been asked before. Is there a way to add a custom parameter to the index action? For example, I would like to be able to search while not breaking existing API functionality given by CURD. Any thoughts on this would be helpful! |
Beta Was this translation helpful? Give feedback.
-
D. Swaroop [DISQUS]: Thanks for the wonderful article. Can you please tell me how the sample xml request should be for adding a Cocktail as I am trying to explore the 'xml' option of the REST API? |
Beta Was this translation helpful? Give feedback.
-
Icaro R. Scherma [DISQUS]: Do you know if is easy to implement to forbid the default HTML render on the Router Scope "/api" ? Because I don't want to SERVER/api/cocktails to be accessed in the browser, only SERVER/api/cocktails.json , I haven't tested to create a /Api/CocktailsController.php yet but with this it will not find the TemplateViews and will throw a 404? |
Beta Was this translation helpful? Give feedback.
-
Icaro R. Scherma [DISQUS]: Ahhh, and please recommend to Mac Users to use Cocoa REST Client (http://mmattozzi.github.io/cocoa-rest-client/) it is way more lightweight and useful than the other solutions =) |
Beta Was this translation helpful? Give feedback.
-
Guima Ferreira [DISQUS]: I followed this tutorial and using Postman it works perfectly, but my AngularJS app is getting "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin I tried use EDIT |
Beta Was this translation helpful? Give feedback.
-
Mark [DISQUS]: hey just wanted to say, thanks so much, this had me up and running with working APIs in minutes. Better than the FriendsOfCake docs themselves :) Now the only suggestion and request would be for slightly more explanations as to what each part is, so that I can really understand what each thing does and how they all fit together - that way I feel I have a better understanding to take things further :) Thanks again |
Beta Was this translation helpful? Give feedback.
-
Mark [DISQUS]: can anyone help - i am getting 'success: true' from my 'edit: put' crud API call, however the underlying table is not really being changed. How do u debug this thing ? :) |
Beta Was this translation helpful? Give feedback.
-
danieldrope [DISQUS]: If something goes wrong how I return a message with a http status code 400? all in json format? |
Beta Was this translation helpful? Give feedback.
-
Thiago Dias [DISQUS]: Hi! I did everything as shown in this tutorial, but when I POST data (equivalent to add action) by the Postman, I recieve the following error:
But I send these data in following json:
What is wrong? (Sorry for my bad english) |
Beta Was this translation helpful? Give feedback.
-
Morga [DISQUS]: Hi, First of all thank you for this tutorial. I have a problem with pagination: I'm creating an app for android which have to query my API for data. There are more than a thousand records in the table, so I have to paginate. I want to load 50 records per page and I know how to load the first 50 records, my problem is that I dont know how to get the next 50 records. I'm new to cakephp and php, it might be easy but I can't figure it out. Any help or link would be appreciate. PS: I'm not using CRUD plugin |
Beta Was this translation helpful? Give feedback.
-
Jérôme Lafforgue [DISQUS]: I met a problem that took me a long time to resolve during authentication with my browser that sends two queries.
Maybe this will help someone. |
Beta Was this translation helpful? Give feedback.
-
Ashish Patel [DISQUS]: Hi Guys, I have implemented CRUD in my project and everything is working fine. But the problem I am facing is related to PUT method I have 2 tables in my database 'animals' and 'animals_images'. When I try to call PUT method to update existing 'animals'. the 'animals' table data is getting updated but the api is inserting new data in 'animals_images' in place of updating in 'animals_images' table. Is there anyone who can help me to fix this problem? Thanks and Regards, |
Beta Was this translation helpful? Give feedback.
-
Sebastián Scarano [DISQUS]: Hi. I tried the tutorial with my own controller/table and all went grate. Except that the index response does not include "pagination" key. I simpliflied pagination to
Changing $paginate values does get reflected on response data. |
Beta Was this translation helpful? Give feedback.
-
Aaron Overton [DISQUS]: If you try to use the templates created by bake to edit anything, you will get a fatal error message about a call to function set() on boolean in BaseAction.php, line 193 (at the time of this writing.) To fix this, you will need to add Flash to your list of components on AppController. |
Beta Was this translation helpful? Give feedback.
-
Sebastien Galarneau [DISQUS]: I'm trying to redo the exact same tutorial step by step. Everything is going well until its comes to POST a cocktail... i'm getting this response from cake
|
Beta Was this translation helpful? Give feedback.
-
Khalil [DISQUS]: I think there's a mistake in the tutorial, |
Beta Was this translation helpful? Give feedback.
-
Khalil [DISQUS]: Great tutorial, and perfect way of explaining everything! |
Beta Was this translation helpful? Give feedback.
-
bharadwaja [DISQUS]: @bravo_kernel:disqus |
Beta Was this translation helpful? Give feedback.
-
sabrinagelbart [DISQUS]: love it. I use Laravel - this is so much better. |
Beta Was this translation helpful? Give feedback.
-
Bikash Chhualsingh [DISQUS]: Is anywhere you mentioned the Cocktails's index() method? There is no index method in the nigher Cocktails controller nor in it's parent controller. |
Beta Was this translation helpful? Give feedback.
-
How to use a CakePHP 3 REST API
https://www.bravo-kernel.com/blog/2015/04/how-to-use-a-cakephp-3-rest-api/
Beta Was this translation helpful? Give feedback.
All reactions