Skip to content

Rest Component Basic Usage

Rolies Debby edited this page Aug 2, 2013 · 2 revisions

Rest component inside this application is wrapper for Requests by rmccue, I just made it more simply to use.

HTTP Get Request

list($body, $info) = Yii::app()->rest->get('/endpoint/path', $args = array(), $header = array());

This will return $body that contain result and $info for HTTP info included header response.

HTTP Post Request

list($body, $info) = Yii::app()->rest->post('/endpoint/path', $args = array(), $header = array(), $extra = array());

For now $extra arguments only accept array('multipart' => true/false) for telling Rest component to send the request with multipart data.

HTTP Put Request

list($body, $info) = Yii::app()->rest->put('/endpoint/path', $args = array(), $header = array(), $extra = array());

HTTP Delete Request

list($body, $info) = Yii::app()->rest->delete('/endpoint/path', $args = array(), $header = array());