Comments (1)
For some weird reasons apiUse
stopped working!! So I removed it entirely for now.
If you haven't made any changes to the default routes file you can replace it with this copy (otherwise tell me I'll explain what I did):
<?php
/*********************************************************************************
* @apiGroup Users
* @apiName Login
* @api {post} /login Login a user
* @apiDescription Login existing User
* @apiVersion 1.0.0
* @apiPermission none
* @apiHeader Accept application/json
* @apiParam {String} email
* @apiParam {String} password
* @apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
{
"data": {
"id": 1,
"name": "Mahmoud Zalt",
"email": "[email protected]",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsIm..."
"created_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
}
*/
$router->post('login', [
'uses' => 'LoginController@handle',
]);
/*********************************************************************************
* @apiGroup Users
* @apiName Logout
* @api {post} /logout Logout a user
* @apiDescription Logout an Authenticated User
* @apiVersion 1.0.0
* @apiPermission Authenticated User
* @apiHeader Accept application/json
* @apiHeader Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ91QiLCJhbGciOiJIUzI1NiJ1...
* @apiSuccessExample {json} Success-Response:
HTTP/1.1 202 Accepted
*/
$router->post('logout', [
'uses' => 'LogoutController@handle',
'middleware' => [
'api.auth',
],
]);
/*********************************************************************************
* @apiGroup Users
* @apiName RegisterUser
* @api {post} /register Register new User
* @apiDescription Create and Login new user
* @apiVersion 1.0.0
* @apiPermission none
* @apiHeader Accept application/json
* @apiParam {String} email
* @apiParam {String} password
* @apiParam {String} name
* @apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
{
"data": {
"id": 1,
"name": "Mahmoud Zalt",
"email": "[email protected]",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsIm..."
"created_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
}
*/
$router->post('register', [
'uses' => 'RegisterController@handle',
]);
/*********************************************************************************
* @apiGroup Users
* @apiName UpdateUser
* @api {put} /users/{id} Update a User
* @apiDescription Update User details
* @apiVersion 1.0.0
* @apiPermission Authenticated User
* @apiHeader Accept application/json
* @apiHeader Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ91QiLCJhbGciOiJIUzI1NiJ1...
* @apiParam {String} password
* @apiParam {String} name
* @apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
{
"data": {
"id": 1,
"name": "Mahmoud Zalt 2",
"email": "[email protected]",
"token": null,
"created_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-04-21 09:45:19.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
}
*/
$router->put('users/{id}', [
'uses' => 'UpdateUserController@handle',
'middleware' => [
'api.auth',
],
]);
/*********************************************************************************
* @apiGroup Users
* @apiName DeleteUser
* @api {delete} /users/{id} Delete a User
* @apiDescription Delete User from Database
* @apiVersion 1.0.0
* @apiPermission Authenticated User
* @apiHeader Accept application/json
* @apiHeader Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ91QiLCJhbGciOiJIUzI1NiJ1...
*/
$router->delete('users/{id}', [
'uses' => 'DeleteUserController@handle',
'middleware' => [
'api.auth',
],
]);
/*********************************************************************************
* @apiGroup Users
* @apiName ListAllUsers
* @api {get} /users Search & List all Users
* @apiDescription List all the Application Users
* @apiVersion 1.0.0
* @apiPermission Authenticated Admin
* @apiHeader Accept application/json
* @apiHeader Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ91QiLCJhbGciOiJIUzI1NiJ1...
* @apiParam search ?search=name:John Doe;email:[email protected]
* @apiParam searchFields ?searchFields=name:like;email:=
* @apiParam paginate ?page=3
* @apiParam order ?orderBy=id
* @apiParam sort ?sortedBy=asc
* @apiParam filter ?filter=id;name;age
* @apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
{
"data": [
{
"id": 2,
"name": "Mahmoud Zalt",
"email": "[email protected]",
"token": null,
"created_at": {
"date": "2016-04-12 06:15:06.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-04-12 06:15:06.000000",
"timezone_type": 3,
"timezone": "UTC"
}
},
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"token": null,
"created_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-04-09 02:34:11.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
],
"meta": {
"pagination": {
"total": 25,
"count": 10,
"per_page": 10,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
*/
$router->get('users', [
'uses' => 'ListAllUsersController@handle',
'middleware' => [
'api.auth',
'role:admin'
],
]);
You may now also delete the ApiDocs Service (Services/ApiDocs
) which holds the apiDefine
variables.
from apiato.
Related Issues (20)
- Composer require problem with requirements
- Installing on cPanel HOT 1
- Search is not working in RequestCriteria HOT 2
- Laravel Passport PKCE HOT 2
- microservice projects HOT 2
- Add Laravel 10 support HOT 6
- Swagger Generator HOT 2
- Your requirements could not be resolved to an installable set of packages
- how to handle relationship HOT 3
- UUID , instead of Hashed Id
- Hash ids error when using "in" operator HOT 2
- Cli generator does not support `criteria` currently
- Why i am getting "Welcome to Apiato" message even after specifying route end point HOT 1
- apiato:apidoc command throw ProcessFailedException Error HOT 9
- API Test Error: "The requested Resource was not found." HOT 5
- Custom Model primaryKey not working! HOT 2
- Installation Error via Composer
- No hint path defined for [mail] HOT 1
- Invalid key supplied HOT 2
- Repository delete() ModelNotFoundException is never thrown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apiato.