# |
Apr 19th 2017, 15:18 |
crazycoder |
k |
# |
Apr 19th 2017, 15:18 |
Neon1024 |
I always get them confused but I think it’s the Content-Type header |
# |
Apr 19th 2017, 15:18 |
Neon1024 |
You need to set the header on the response to application/json |
# |
Apr 19th 2017, 15:17 |
crazycoder |
Neon1024, how? because if i do website/blablablabla i get the html NOT found page |
# |
Apr 19th 2017, 15:17 |
Neon1024 |
I use the default exceptions, but I’ve had to make my own exception renderer to customise the json output |
# |
Apr 19th 2017, 15:17 |
Neon1024 |
Yep |
# |
Apr 19th 2017, 15:16 |
crazycoder |
Neon1024, is there a way to render the error on a json call? |
# |
Apr 19th 2017, 15:13 |
sjundee |
Hi! Anyone who has experience working with CSV? When my title row is the very first line in the file, the first element `$cols[0]` isn't found in `array_search()`. I try `$key_id = array_search('Id', $cols)`, but when it is on the very first line, it doesn't work. When it after the first line, I get what I expect. |
# |
Apr 19th 2017, 15:09 |
Neon1024 |
:D |
# |
Apr 19th 2017, 15:09 |
crazycoder |
i am working on ubuntu and deploying on ubuntu too |
# |
Apr 19th 2017, 15:09 |
crazycoder |
:D |
# |
Apr 19th 2017, 15:04 |
Neon1024 |
Not that I did that last week :p |
# |
Apr 19th 2017, 15:04 |
Neon1024 |
If like me you develop on Mac OS and go live on Ubuntu |
# |
Apr 19th 2017, 15:04 |
Neon1024 |
Otherwise you might put it into production and nothing will work |
# |
Apr 19th 2017, 15:03 |
Neon1024 |
I’d also double check that a plugin called ‘API’ works okay on case sensitive file systems |
# |
Apr 19th 2017, 15:03 |
crazycoder |
thanks! |
# |
Apr 19th 2017, 15:02 |
Neon1024 |
(y) |
# |
Apr 19th 2017, 15:02 |
Neon1024 |
Controllers are Capitalised |
# |
Apr 19th 2017, 15:02 |
crazycoder |
/ <-- |
# |
Apr 19th 2017, 15:02 |
crazycoder |
that's the problem |
# |
Apr 19th 2017, 15:02 |
Neon1024 |
Thirdly |
# |
Apr 19th 2017, 15:02 |
crazycoder |
Neon1024, yeah |
# |
Apr 19th 2017, 15:02 |
Neon1024 |
Plus, I always tend to prefix my routes with a / |
# |
Apr 19th 2017, 15:02 |
crazycoder |
but why? i wrote the action there |
# |
Apr 19th 2017, 15:02 |
Neon1024 |
Not sure the plugin name should be all UPPERCASE |
# |
Apr 19th 2017, 15:02 |
crazycoder |
yes it use the 1 as the action |
# |
Apr 19th 2017, 15:01 |
Neon1024 |
Two things stand out to me |
# |
Apr 19th 2017, 15:01 |
crazycoder |
Neon1024, {"controller":"Agents","action":"1","pass":["cv"],"plugin":"API","_ext":"json"} |
# |
Apr 19th 2017, 15:01 |
Neon1024 |
Also, beware of exposing auto-increment id’s in your api urls |
# |
Apr 19th 2017, 15:01 |
crazycoder |
Neon1024, https://gist.github.com/anonymous/4dc2c6942fef4025587de9198273c6f9 |
# |
Apr 19th 2017, 15:00 |
Neon1024 |
crazycoder: bin/cake routes check /api/agents/1/cv.json |
# |
Apr 19th 2017, 15:00 |
Neon1024 |
crazycoder: Route isn’t matchig the extension and is instead falling back to another route |
# |
Apr 19th 2017, 15:00 |
Neon1024 |
crazycoder: Not inside the api prefix? |
# |
Apr 19th 2017, 14:59 |
saeideng |
this routes not math with your defination |
# |
Apr 19th 2017, 14:58 |
saeideng |
see routes panel in your debug_kit |
# |
Apr 19th 2017, 14:52 |
crazycoder |
why does it take the 1 as the action name ? |
# |
Apr 19th 2017, 14:52 |
crazycoder |
with /api/agents/1/cv.json |
# |
Apr 19th 2017, 14:52 |
crazycoder |
2017-04-19 16:51:43 Error: [Cake\Controller\Exception\MissingActionException] Action AgentsController::1() could not be found, or is not accessible. |
# |
Apr 19th 2017, 14:52 |
crazycoder |
$routes->connect(':controller/:id/cv', ['controller' => 'Agents', 'action' => 'cv', 'plugin' => 'API']); |
# |
Apr 19th 2017, 14:44 |
mampel |
@dakota thank I fixed that |
# |
Apr 19th 2017, 14:41 |
saeideng |
languagae array ? |