我有大部分的輸入參數被置於作爲一個JSON請求對象的請求JSON請求的所有輸入。出於文檔的目的,我想指定用戶可以放入的最常見的字段,但是名稱值存在很多可變性,這些可能會進入JSON請求,我不想將所有這些文檔記錄下來,因爲它會麻煩。捕獲在(使用Restler)
這裏是什麼,我現在有一個截圖:
好像我想把在稱爲JSON財產「人與」並將其設置爲「[‘喬’的例子, 「保羅」,「簡」]那麼這將是容易的JSON做的,但我怎麼會挑選在我的PHP/Restler代碼現在該服務的簽名是:
/**
* ADD an Activity
*
* Add a new action to a user's stream
*
* @url POST /{user_id}
*
* @param integer $user_id The user_id for whom the actions apply; you can insert the text "self" and it will resolve to the current/default user
* @param string $start_time {@from body} The date/time that the activity was started (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
* @param string $action {@from body} The action "slug name" that uniquely identifies an action
* @param string $end_time {@from body} The date/time that the activity concluded (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
* @param string $app_id {@from body} The application that captured this activity
* @param string $proxy_user_id {@from body} The person who captured this activity for the individual
* @param string $location {@from body} The location information associated with this activity
*/
public function add_action ($user_id, $start_time, $action, $end_time=null, $app_id=null, $proxy_user_id=null, $location=null)
{
// implement
}
PS爲一個側面說明,我已經暫時將此API服務更改爲PUT以避免POST問題幾天前提出了這個問題,在使用POST的同時也影響了我。
這樣做的唯一不良結果是$ request_data在文檔中出現。任何人都知道避免這種方式? – ken
$ request_data不應該出現在那裏,它是Resources.php中的一個錯誤將很快修復 – Luracast
只是推動更新來解決這個:) – Luracast