Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to add functions #56

Closed
Midhilaj opened this issue Jan 4, 2016 · 2 comments
Closed

failed to add functions #56

Midhilaj opened this issue Jan 4, 2016 · 2 comments

Comments

@Midhilaj
Copy link

Midhilaj commented Jan 4, 2016

i try to add my own function , but not works
help me to add function in this code for making post request

"Logged in " . $username); } /_* \* Gets the user by id or current user * \* @url GET /users/$id \* @url GET /users/current _/ public function getUser($id = null) { // if ($id) { // $user = User::load($id); // possible user loading method // } else { // $user = $_SESSION['user']; // } return array("id" => $id, "name" => null); // serializes object into JSON } /_* \* Saves a user to the database * \* @url POST /users \* @url PUT /users/$id _/ public function saveUser($id = null, $data) { // ... validate $data properties such as $data->username, $data->firstName, etc. // $data->id = $id; // $user = User::saveUser($data); // saving the user to the database $user = array("id" => $id, "name" => null); return $user; // returning the updated or newly created user object } /_* \* Get Charts \* \* @url GET /charts \* @url GET /charts/$id \* @url GET /charts/$id/$date \* @url GET /charts/$id/$date/$interval/ \* @url GET /charts/$id/$date/$interval/$interval_months _/ public function getCharts($id=null, $date=null, $interval = 30, $interval_months = 12) { echo "$id, $date, $interval, $interval_months"; } /_* \* Throws an error \* \* @url GET /error */ public function throwError() { throw new RestException(401, "Empty password not allowed"); } }
@jacwright
Copy link
Owner

Sorry, could you be more clear about what is not working? What function is yours that isn't working?

@Midhilaj
Copy link
Author

sorry for making trouble , everything works fine , on first time i don't get rest server concepts that make this issue (and now you are my guru in php rest server script)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants