使用curl和访问令牌POST JSON。获取:非法格式化的输入字段!错误。广告API

时间:2016-04-21 17:52:49

标签: php json post curl

我很陌生并且很困惑。到目前为止我的代码是:

curl -H 'Content-Type: application/json' -H 'Accept: application/json'\
  -F 'name=My new CA' \
  -F 'subtype=CUSTOM' \
  -F 'description=People who bought from my website' \
  -F -d 'rule': {'and': ['or': [{'unit_id': {'gte': '0'}}]]}\
  -F 'access_token=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' \
  https://graph.facebook.com/v2.5/act_XXXXXXXXXXXXXX/customaudiences

我无法弄清楚如何发布嵌套请求,我收到以下错误:

Warning: Illegally formatted input field!
curl: option -F: is badly used here
curl: try 'curl --help' or 'curl --manual' for more information

任何建议表示赞赏!感谢

1 个答案:

答案 0 :(得分:1)

看看你发送的是什么:

-F -d 'rule': {'and': ['or': [{'unit_id': {'gte': '0'}}]]}\
      ^--start string
           ^--end string
            ^--random garbage
               ^--start another string
                   ^--end string