https://github.com/barisesen/simple-laravel-api
You can test it easily!
https://github.com/barisesen/simple-laravel-api
api laravel token-authetication
Last synced: about 1 month ago
JSON representation
You can test it easily!
- Host: GitHub
- URL: https://github.com/barisesen/simple-laravel-api
- Owner: barisesen
- Created: 2017-06-28T13:52:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-28T14:28:53.000Z (almost 9 years ago)
- Last Synced: 2025-03-27T19:54:25.658Z (about 1 year ago)
- Topics: api, laravel, token-authetication
- Language: PHP
- Homepage: https://simple-laravel-api.herokuapp.com/
- Size: 167 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Simple Token based api
Token kullanılarak yapılmış basit bir api örneğidir. Her yapılan istekte parametre olarak api_token gönderilmelidir.
Parametlere olarak göndermek yerine headerda
Authorization:Bearer api_token
Şeklinde kullanılabilir.
Kullanıcı giriş ve kayıttan sonra api_token döner.
## Getting with ajax
### Login
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/user/login',
type : "POST",
data : "email=iletisim@barisesen.com&password=password",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### Register
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/user/login',
type : "POST",
data : "name=baris&email=iletisim@barisesen.com&password=password",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### Add New Note
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/notes',
type : "POST",
data : "api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v11ViKkdvw7ZK4sqrEhld&body=api test",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### list All Notes
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/notes?api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v11ViKkdvw7ZK4sqrEhld',
type : "GET",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### list Only my Notes
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/user/notes?api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v1ViKkdvw7ZK4sqrEhld',
type : "GET",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### Show Note
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/notes/**:id**?api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v1ViKkdvw7ZK4sqrEhld',
type : "GET",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### Delete My Note
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/notes/**:id**',
type : "Delete",
data : "api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v11ViKkdvw7ZK4sqrEhld",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
### Update My Note
$.ajax({
url : 'https://simple-laravel-api.herokuapp.com/api/notes/**:id**',
type : "PATCH",
data : "api_token=gFbAfiphLKzlz13wPHK89ezTsn446BSbzS2ZTId5v11ViKkdvw7ZK4sqrEhld&body=updated post test",
headers: {
'Accept':'application/json'
},
dataType : 'json',
success : function (resp) {
console.log(resp);
}
});
## Contributors
- [barisesen](https://github.com/barisesen) Barış Esen [barisesen.com](https://barisesen.com) - creator, maintainer