【问题标题】:Restler API Explorer POSTing JSON dataRestler API Explorer 发布 JSON 数据
【发布时间】:2013-03-13 11:01:48
【问题描述】:

我在使用 Restler API Explorer 将 JSON 数据发布到我的 Restler Web 服务时遇到问题。

这是一个例子

/**
 * Inserts a product
 * 
 * @param string    $product_id {@from body} The SKU for the product
 * @return a product object which contains the product
 */
function post($product_id=NULL, $request_data=NULL){

error_log(var_export($request_data,1));
}

当我通过资源管理器发布以下 JSON 字符串时

{"product_id": "MOO"}

我在日志中得到以下输出

array ('{____"product_id":_"MOO"}' => '','index_url' => 'index',)

如果我使用 CURL,例如

curl -X POST http://xxx.xxx.xxx/products.json -H "Content-Type: application/json" -d '{"product_id": "MOO"}'

我明白了

array ('product_id' => 'MOO','index_url' => 'index',)

这是我所期望的。

能看出哪里不对吗?

干杯 抢

【问题讨论】:

    标签: php restler


    【解决方案1】:

    这是由于一个月前修复的 API Explorer 中的一个错误

    https://github.com/Luracast/Restler-API-Explorer 将您的资源管理器更新到最新版本

    删除您的缓存并让问题消失

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-06
      • 2021-12-16
      • 2015-08-19
      • 2011-11-24
      • 1970-01-01
      相关资源
      最近更新 更多