Dialogflow es Dialogflow v2 REST调用返回400个错误请求

Dialogflow es Dialogflow v2 REST调用返回400个错误请求,dialogflow-es,Dialogflow Es,发出此entityTypes.create调用时,我收到400个错误请求: wget --header="Authorization: Bearer ${TOKEN}" \ --post-data=' { "displayName": "writer1", "kind": "KIND_MAP", "autoExpansionMode": "AUTO_EXPANSION_MODE_DEFAULT", "entities": [ { "value": "Virginia Woolf", "syno

发出此entityTypes.create调用时,我收到400个错误请求:

wget --header="Authorization: Bearer ${TOKEN}" \
 --post-data=' { "displayName": "writer1", "kind": "KIND_MAP", "autoExpansionMode": "AUTO_EXPANSION_MODE_DEFAULT", "entities": [ { "value": "Virginia Woolf", "synonyms": [ "Virginia Woolf" ] } }' \
 https://dialogflow.googleapis.com/v2/projects/MyProject/agent/entityTypes
但是这个--entityTypes.list--工作正常:

wget --header="Authorization: Bearer ${TOKEN}" \
https://dialogflow.googleapis.com/v2/projects/MyProject/agent/entityTypes
有什么想法吗?谢谢。

默认情况下,
--post data
使用的内容类型为
application/x-www-form-urlencoded
。API要求内容类型为
application/json

我倾向于使用更像

wget \
 --header="Authorization: Bearer ${TOKEN}" \
 --header="Content-type: application/json" \
 --post-data='{ ... }' \
 https://dialogflow.googleapis.com/v2/projects/MyProject/agent/entityTypes

谢谢。显然需要。。还有一个格式错误的json表达式需要修复。