2

オプションのパラメーターが URL 変数として渡される RESTful API を作成しました。ブラウザーから直接実行すると正しく動作するように見えますが、API Explorer で実行しようとすると、パラメーターがリストされますが、実行時に無視されます。これを解決するためにどこから始めるべきかわかりません。どんな助けでも大歓迎です。

クラス定義は次のとおりです。

class actions {

  /**
   * LIST available Actions
   *
   * List all the actions that a user (or app) can choose from. The response list  
   * will include [name],[slug/id], and [description] attributes. If you want a more complete set of 
   * meta attributes for the actions then you can specify "meta=all" in the request url. For full spec of
   * response please review LG_actions_list.json.
   *
   * @url GET /available
   *
   * @param $meta {@from url} Optional parameter to control the amount of meta-data passed back. Values are "none","normal", and "all"
   **/
  public function available ($meta="normal")
  {
    return "list actions (meta level set to $meta)";
  }

}

この場合、API エクスプローラーで $meta の値として「all」と入力できますが、応答は「リスト アクション (メタ レベルを通常に設定)」のままです。

アップデート:

この動作を明確にするために、API Explorers の出力と、サービスを直接呼び出したときに取得する出力を追加しています。

ここに画像の説明を入力

比較すると、実際に API を使用すると、正しい結果が得られます。これをChromeに入力します:

http://[ドメイン]/api/actions/available?meta=foobar

次の目的の出力が得られます。

「リストアクション (メタレベルを foobar に設定)」

4

1 に答える 1