用户字段信息错误 - API 文档

create user field

I see

{
  "user_field[name]": "string",
  "user_field[description]": "string",
  "user_field[field_type": "string",
  "user_field[required]": true
}

Are you sure ?

I think it should be something like

{
  "user_field: {
     "name": "asdf",
     "description": "asdf",
     "field_type": "confirm",
     "required": true
  }
}

I believe that @blake wrote that documentation so let’s see what he reckons here.

Yes, if you are using Content-Type: application/json you should send it in like

The example in the api docs is using Content-Type: multipart/form-data, but I’ll be sure to update it to the json example.

2 个赞

Screen Shot 2020-08-20 at 15.48.17

Thank you @blake

Note:
The problem is … i see application/json in the example (so that’s why my partner spent all hours to figure it out how to use this call)

2 个赞

我也为此苦苦挣扎了大约 24 小时,因为文档示例建议为创建新用户格式化为 application/json 请求,将 user_field 设置为布尔值……

我被告知我没有填写所有必需的用户字段……但在我的例子中,我有一个现有的必需 user_field,我需要向该字段输入数据,并且它应该格式化如下:

{
  "name": "Full Name",
  "email": "email@address.com",
  "password": "348hqpwfaed",
  "username": "UserName",
  "user_fields": {
    "1": "Required User Field Data"
  }
}

上面的格式对我来说是有效的。

文档在创建新用户方面是否正确?

1 个赞

不,那仍然是 form-data 格式。我已将其更新为使用 json,以便示例与格式匹配。感谢您提出这个问题!

2 个赞