通过api在自定义PickList字段中指定空白值

时间:2019-09-26 13:57:32

标签: bigcommerce

如何为自定义字段指定一个空值 https://developer.bigcommerce.com/api-reference/customer-subscribers/v3-customers-api/customer-form-fields/customerformfieldvalueput

PUT https://api.bigcommerce.com/stores/:store_id/v3/customers/form-field-values

[
    {
        "name": "MyCustomField",
        "address_id": 395,
        "value": ""
    }
]

给我这个

{
    "status": 422,
    "title": "Create form field value failed.",
    "type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes",
    "errors": {
        "0.form_field_value": "Option '' does not exist in 'MyCustomField'"
    }
}

我也尝试过 "value": null 结果

"errors": {
    "0.data": "Missing form-field value for form-field 'MyCustomField'"
}

"value": undefined 结果

{
    "status": 400,
    "title": "Input is invalid",
    "type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes",
    "errors": {}
}

1 个答案:

答案 0 :(得分:0)

如果要将呼叫发送到的商店中尚不存在自定义表单字段,则会看到类似“客户表单中不存在表单字段'test'的错误”。设置为现有字段的名称后,我就能够成功发送一个呼叫,如此处所述。

您还在以编程方式创建自定义表单字段吗?您可能需要添加逻辑,以便仅在创建字段之后才运行此调用。