Web services drupal服务自定义资源中的查询字符串
我试图在drupal服务API中使用查询字符串结构。这对我不起作用。 我也搜索了大多数解决方案,但都失败了。 以下是m drupal代码:Web services drupal服务自定义资源中的查询字符串,web-services,rest,drupal,drupal-7,drupal-services,Web Services,Rest,Drupal,Drupal 7,Drupal Services,我试图在drupal服务API中使用查询字符串结构。这对我不起作用。 我也搜索了大多数解决方案,但都失败了。 以下是m drupal代码: function rapid_services_resources() { $resources = array( 'get_data' => array( 'operations' => array( 'retrieve' => array( 'help' => t('Ge
function rapid_services_resources() {
$resources = array(
'get_data' => array(
'operations' => array(
'retrieve' => array(
'help' => t('Gets user email of uid passed.'),
'callback' => 'my_module_get_user_email',
'args' => array(
array(
'name' => 'nid',
'type' => 'int',
'description' => 'The display ID of the view to get.',
'source' => array('param' => 'nid'),
'optional' => TRUE,
'default value' => 'default',
),
),
'access arguments' => '_blog_access_provide_access',
'access callback' => '_blog_access_provide_access',
//~ 'access arguments append' => FALSE,
),
),
),
);
return $resources;
}
function _blog_access_provide_access() {
return TRUE;
}
function my_module_get_user_email($nid){
var_dump($args);die;
}
我想要这样的url:
http://localhost/drupaltest/rapidapi/get_data/?nid=111
请告诉我哪里做错了。
提前感谢。您好,这里有一些有用的参考资料 我也不确定查询字符串,但是对于检索操作,您可以将其设置为url的一部分 例: 我认为source
param
只适用于索引
操作,而不适用于检索
http://localhost/drupaltest/rapidapi/get_data/<nid should be here>
http://localhost/drupaltest/rapidapi/get_data/111
'source' => array('path' => '0'),