【发布时间】:2015-12-17 18:23:43
【问题描述】:
也许有人知道一些好的模块来创建 API 端点,以便用户可以通过使用 POST 变量的 API 调用创建/更新内容?
扩展问题:
基本上我需要编写一个具有稳定身份验证端点的自定义模块:
// Use some module, to provide authentication to this endpoint
function example_menu() {
$items = array();
$items['api/v2/endpoint'] = array(
'page callback' => 'example_accept',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function example_accept() {
// Identify if user has permission to edit some nodes
// Read $_POST vars
// Use post data to update nodes, that belongs to the user
}
【问题讨论】: