Luracast / Restler

Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and/or RESTful API
http://luracast.com/products/restler/
GNU Lesser General Public License v2.1
1.36k stars 316 forks source link

Documenting PUT requests #344

Closed davidsneighbour closed 10 years ago

davidsneighbour commented 10 years ago

I saw in the Restler API Explorer that parameters can be documented so that eg. next to the REQUEST_BODY a list of possible parameters appear. This is only working if I use the put method with each parameter separately defined.

Is there any way do annotate/document the parameters that could appear when I am using request_data?

To clarify, at the moment I am using extended classes and have to use a construct like the following one to have some kind of documentation:

function put($id, $param1=NULL, $param2=NULL) {
    $request_data['param1'] = $param1;
    $request_data['param2'] = $param2;     
    return parent::_put($id, $request_data);
}

I then document the child put function and the parent put function is doing "the magic". this is ok for as long as my request_data is not too big. If I have twenty or thirty parameters it gets convoluted so it would be nice to have $request_data AND documentation.

Arul- commented 10 years ago

purpose of request_data is to have the convenience of any data! if you have specific structure in mind you should use a class instead.

See Author class in http://restler3.luracast.com/examples/_009_rate_limiting/readme.html for an example

Explorer: http://restler3.luracast.com/examples/_009_rate_limiting/explorer/index.html?baseUrl=..%2Fresources.json&apiKey=r3rocks#!/authors/update_put with the apiKey r3rocks

davidsneighbour commented 10 years ago

great, that's exactly what I needed. thanks.