Skip to content

tomnt/note

Repository files navigation

Notes API

This is a simple API built on top of Laravel for "notes" application.

User:
A user in the system. It contains the following fields:

  • Email: Non-blank, valid email address, unique
  • Password: Non-blank, at least 8 characters
  • Create Time
  • Last Update Time

Note:
A note in the system. Notes are associated with Users. A user can have many notes. A note has the following fields:

  • Title: Non-blank, max 50 characters long
  • Note: max 1000 long
  • Create Time
  • Last Update Time

RESTful API:

  • Design and build a RESTful API to allow CRUD operations on notes.
  • Support JSON for requests and responses.
  • Note access should be restricted to the owner of the note.

Authentication:
Use Basic HTTP Authentication.

Program files set up

# Obtaining code
git clone https://github.com/tomnt/note

# Moving to repository directory
cd note

# Obtaining dependencies
composer install

# Starting service
php artisan serve

Basic Authentication

  • Username: user
  • Password: password

The username and password are being defined at;
config/very_basic_auth.php

Create [POST]

curl -X POST "http://127.0.0.1:8000/api/note/" -d "user_id=1&title=Foo!" --user user:password

http://127.0.0.1:8000/api/note?user_id=1&title=Foo!

Read [GET]

curl -X GET "http://127.0.0.1:8000/api/note/" --user user:password
curl -X GET "http://127.0.0.1:8000/api/note/" -d "title=they" --user user:password
curl -X GET "http://127.0.0.1:8000/api/note/123/" --user user:password

http://127.0.0.1:8000/api/note/
http://127.0.0.1:8000/api/note?title=they
http://127.0.0.1:8000/api/note/123/

Update [PUT]

curl -X PUT "http://127.0.0.1:8000/api/note/12/" -d "title=Foo!" --user user:password

http://127.0.0.1:8000/api/note/12/?title=Foo!

Delete [DELETE]

curl -X DELETE "http://127.0.0.1:8000/api/note/5/" --user user:password

http://127.0.0.1:8000/api/note/5/

System Requirements

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published