1

使用
Drupal 7.x、
服务 3.x。

一切正常,
登录
获取所有节点
注销
获取令牌等

只有在注册新用户时,我才得到响应 500 服务不可用!

像这样尝试,

POST 方法

xyz.com/rest/user/register

休息是终点!

像这样发布注册数据,

{
"name":"user343",
"pass":"kes35@r4",
"mail":"user343@sample.com",
"status":"1"
}
4

1 回答 1

1

您的错误是由 drupal 服务模块中的错误验证调用引起的。这是一个很难追踪的。尝试在 services/resources/user_resource.inc 文件中快速修补以进行修复。

diff --git a/resources/user_resource.inc b/resources/user_resource.inc
index 04801fb..7693f2d 100644
--- a/resources/user_resource.inc
+++ b/resources/user_resource.inc
@@ -335,14 +335,6 @@ function _user_resource_create($account) {
   // Execute the register form.
   $form_state['programmed_bypass_access_check'] = FALSE;

-  // Ensure this is validated, as drupal_form_submit will not call validation.
-  user_register_validate('user_register_form', $form_state);
-  $errors = form_get_errors();
-  // If there are errors, then short circuit and return early.
-  if ($errors) {
-   return services_error(implode(' ', $errors), 406, array('form_errors' => $errors));
-  }
-
   drupal_form_submit('user_register_form', $form_state);
   // find and store the new user into the form_state
   if(isset($form_state['values']['uid'])) {

如果您对标准补丁不满意,您可以注释掉这些行以快速应用手动修复。来自此页面的信息。继续享受 Drupal!

于 2016-03-07T22:02:22.263 回答