Ayano is sharing links api-only project. Ayano was build on testing driven development. Ayano project's just for learning purpose.
The Enpoints will be written based on features.
POST
/api/auth
{
"auth": {
"username": "your_username",
"password": "your_password"
}
}
If username and password is true
{
"jwt": "your_token_here"
}
If username and password is false
{
"error": {
"code": 422,
"message": "username or password is wrong"
}
}
POST
/api/links
{
"link": {
"title": "title of links",
"url": "https://philiplambok.github.io"
}
}
If success
{
"link": {
"title": "title of links",
"url": "https://philiplambok.github.io"
}
}
if error, user not authenticate
{
"error": {
"code": 401,
"message": "you not authenticate"
}
}
Show link data
GET
/api/link/:id
If success
{
"link": {
"title": "title of links",
"url": "https://philiplambok.github.io"
}
}
If link not found
{
"error": {
"code": 404,
"message": "link not found"
}
}
GET
/api/link/:id/user
If success
{
"user": {
"username": "futurebugs",
"role_name": "user"
}
}
If link not found
{
"error": {
"code": 404,
"message": "link not found"
}
}
Aktors:
- Owner User
- Admin
PUT/PATCH
/api/link/:id
{
"link": {
"title": "your updated name",
"url": "https://philiplambok.moe"
}
}
if success
{
"link": {
"title": "your updated name",
"url": "https://philiplambok.moe"
}
}
If error, request by not owner or admin
{
"error": {
"code": 403,
"message": "Sorry, you can't update this link"
}
}
if user not authenticated
{
"error": {
"code": 401,
"message": "you not authenticate"
}
}
Aktors:
- Owner User
- Admin
DELETE
/api/link/:id
If success
{
"link": {
"title": "you updated name",
"url": "https://philiplambok.moe"
}
}
If error, request by not owner or admin
{
"error": {
"code": 403,
"message": "Sorry, you can't delete this link"
}
}
if user not authenticated
{
"error": {
"code": 401,
"message": "you not authenticate"
}
}
GET
/api/users
{
"users": [
{
"user": {
"username": "pquest",
"role_name": "admin"
}
},
{
"user": {
"username": "futurebugs",
"role_name": "user"
}
}
]
}
GET
/api/user/:id
if success
{
"user": {
"username": "pquest",
"role_name": "admin"
}
}
if error, user not found
{
"error": {
"code": 404,
"message": "Sorry, user not found"
}
}
GET
/api/user/:id/links
if success
{
"links": [
{
"link":{
"title": "link one",
"url": "https://link.one"
}
},
{
"link":{
"title": "link two",
"url": "https://link.two"
}
},
]
}
You be free to use, copying, or something that i don't know :)