This topic is locked

PHPRunner REST API

8/26/2020 1:26:27 PM
Suggestions
A
acpan author

Form the manual:
Add a category named Beer with description Beer and stuff.



curl -X POST "http://localhost:8086/api/v1.php?table=categories&action=insert"; -d "CategoryName=Beer&Description=Beer and stuff" -H "Content-Type: application/x-www-form-urlencoded"


And response will contain the whole new record including the autoincrement column:



{

"success":true,

"data":{

"CategoryName":"Beer",

"Description":"Beer and stuff",

"CategoryID":272

}

}


Suggestion: In the events, we can for example query another table and insert the data as additional params and return to the request:



{

"success":true,

"data":{

"CategoryName":"Beer",

"Description":"Beer and stuff",

"CategoryID":272,



"new_params1":new_data,

"new_params2":new_data



}

}


It will make good sense, if we can also do some manipulations on the params before return the REST request, eg. change one of the values, such as perform some arithmetic operations, string concatenation, since that is the advantage of PHPRunner with pre and post events.
Thanks

ACP