Closed (works as designed)
Project:
Services
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2011 at 14:31 UTC
Updated:
20 Jul 2011 at 16:59 UTC
When creating a REST resource with hook_services_resources() and adding an action, the action is being overridden by retrieve and retrieve is taking my action as an argument.
<?php
function brain_api_services_resources() {
return array(
'brain' => array(
'retrieve' => array(
'help' => 'Retrieves a user\'s brain',
'callback' => 'brain_api_user_retrieve',
'access callback' => 'user_access',
'access arguments' => array('access content'),
'access arguments append' => false,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'The user id of the brain to get',
'source' => array('path' => '0'),
'optional' => false,
'default value' => NULL
),
),
),
'index' => array(
'access callback' => 'user_access',
'access arguments' => array('access content'),
'access arguments append' => false,
'args' => array(),
'help' => 'Retrieves brain memories',
'callback' => 'brain_api_memories_index',
),
'actions' => array(
'memories' => array(
'help' => 'Return memories object',
'callback' => 'brain_api_memories',
),
)
),
);
}
Comments
Comment #0.0
didlix commentedprofile to brains
Comment #0.1
didlix commentedcleaner spacing
Comment #1
didlix commentedHaving explored the code a little, I've noticed I was trying to access the wrong url as actions are mapped to controller/res/action/action_name
However, with that in mind, when accessing person.local/res/brain/action/memories I get 404 Not Found: Could not find the controller
Comment #2
didlix commentedShould be called via POST.
Comment #2.0
didlix commentedtidied up tabbing