【问题标题】:Drupal 7 | Update content via API endpoint?Drupal 7 |通过 API 端点更新内容?
【发布时间】: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
}   

【问题讨论】:

    标签: api drupal endpoint


    【解决方案1】:

    你应该看看这个模块:https://www.drupal.org/project/services

    它相当复杂,因此您应该花一些时间查看文档,例如服务手册:https://www.drupal.org/documentation/modules/services

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多