- VirtualBox. Tested on 5.0.14, but 4.x.x should also work.
- Vagrant. Tested on 1.8.1
- Ansible. Tested on 2.0.1.0
- Laravel. Tested on 5.2.x
- PSR. We are following PSR coding standards.
vagrant box add https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.04/ubuntu-14.04-amd64.box --name ubuntu/trusty64
(we use Ubuntu 14.04 LTS for box)vagrant plugin install vagrant-vbguest
(Optional: for fixing vb-guest issue)vagrant up
vagrant provision
(Optional: for re-provision if there are changes)
- add
127.0.0.1 laravel-mongodb-api
to/etc/hosts
chmod -R 777 /api/storage
- Access API with http://laravel-mongodb-api:8080
vagrant ssh
for shh to this servercomposer dump-autoload
at/vagrant/api
./vendor/bin/phpunit tests
to run test- (Optional: if you want to initial data,
php artisan db:seed
in/vagrant/api
)
Run these commands in local:
vagrant up
- List all customers
- Retrieve a customer
- Create a new customer
- Update customer
- Delete customer
- Add features to customer
Name | Type | Description |
---|---|---|
id | object_id | A USER_ID matching /user?_[1-9a-z]+/ . |
firstname | string | First name of the user. |
lastname | string | Last name of the user. |
string | Email of the user. | |
created_at | datetime | Creation date of the user. |
updated_at | datetime | Update date of the user. |
{
"data": [
{
"id": "561789d9068dabe909bb958b",
"firstname": "Nicolette",
"lastname": "Robel",
"email": "Wehner.Albert@example.net",
"created_at": "2015-10-09 09:33:13",
"updated_at": "2016-01-10 16:47:20"
},
{
"id": "5617d669068dab3e0d535507",
"firstname": "Monty",
"lastname": "Wyman",
"email": "mSawayn@example.com",
"created_at": "2015-10-09 14:59:53",
"updated_at": "2016-01-27 16:06:50"
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
GET /api/users
Name | Type | Description |
---|---|---|
limit | integer | (optional, default: 20, maximum: 100) The maximum amount of records returned. |
from | datetime | (optional, default: 2015-01-01 ) The date and time limiting the beginning of returned records. E.g.: 2016-04-25 00:00:00 |
to | datetime | (optional, default: current Datetime) The date and time limiting the end of returned records. E.g.: 2016-04-26 00:00:00 |
order | string | (optional, default: desc) The order of the list returned. I.e.: desc (from earliest to latest), asc (from latest to earliest). |
GET /api/users/USER_ID
POST /api/users
Name | Type | Description |
---|---|---|
firstname (maximum: 255) | string | (required) Firstname of the user. |
lastname (maximum: 255) | string | (required) Lastname of the user. |
email (maximum: 255, unique) | string | (required) Email of the user. |
pasword | string | (required) Password of ths user. |
password_confirmation | string | (required) Must be same as the password . |
country (minimum: 2, maximum: 5) | string | (required) Country code of the user. |
PATCH /api/users/USER_ID
Name | Type | Description |
---|---|---|
firstname (maximum: 255) | string | (required) Firstname of the user. |
lastname (maximum: 255) | string | (required) Lastname of the user. |
email (maximum: 255, unique) | string | (required) Email of the user. |
pasword | string | (required) Password of ths user. |
password_confirmation | string | (required) Must be same as the password . |
country (minimum: 2, maximum: 5) | string | (required) Country code of the user. |
DELETE /api/users/USER_ID
Name | Type | Description |
---|---|---|
id | object_id | A CUSTOMER_ID matching /customer?_[1-9a-z]+/ . |
name | string | name of the customer. |
description | string | description of the customer. |
string | Email of the customer. | |
created_at | datetime | Creation date of the customer. |
updated_at | datetime | Update date of the customer. |
features | list | List of feature associate with customer. |
{
"data": [
{
"id": "57271f6dd199ae0678232863",
"name": "Rebeka Champlin",
"description": "Alias magni similique porro quo quisquam quia eaque.",
"email": "hblock@example.org",
"cre
E8F8
ated_at": "2015-10-09 09:33:13",
"updated_at": "2016-01-10 16:47:20",
"features": []
},
{
"id": "57271f6dd199ae0678232864",
"name": "Kaleb Funk MD",
"description": "Voluptates dolor facere sapiente est explicabo voluptatibus error. ",
"email": "trystan97@example.net",
"created_at": "2015-10-09 14:59:53",
"updated_at": "2016-01-27 16:06:50",
"features": []
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
GET /api/customers
Name | Type | Description |
---|---|---|
limit | integer | (optional, default: 20, maximum: 100) The maximum amount of records returned. |
from | datetime | (optional, default: 2015-01-01 ) The date and time limiting the beginning of returned records. E.g.: 2016-04-25 00:00:00 |
to | datetime | (optional, default: current Datetime) The date and time limiting the end of returned records. E.g.: 2016-04-26 00:00:00 |
order | string | (optional, default: desc) The order of the list returned. I.e.: desc (from earliest to latest), asc (from latest to earliest). |
GET /api/customers/CUSTOMER_ID
POST /api/customers
Name | Type | Description |
---|---|---|
name (maximum: 255, unique) | string | (required) Name of the customer. |
description | string | (required) Description of the customer. |
email (maximum: 255, unique) | string | (required) Email of the customer. |
PATCH /api/customers/CUSTOMER_ID
Name | Type | Description |
---|---|---|
name (maximum: 255, unique) | string | (required) Name of the customer. |
description | string | (required) Description of the customer. |
email (maximum: 255, unique) | string | (required) Email of the customer. |
DELETE /api/customers/CUSTOMER_ID
POST /api/customers/CUSTOMER_ID/features
Name | Type | Description |
---|---|---|
features_id | array | (required) Array of feature to add to customer. |
Name | Type | Description |
---|---|---|
id | object_id | A FEATURE_ID matching /feature?_[1-9a-z]+/ . |
name | string | Name of the feature. |
display_name | string | Display name of the feature. |
description | string | Description of the feature. |
created_at | datetime | Creation date of the feature. |
updated_at | datetime | Update date of the feature. |
{
"data": [
{
"id": "57271f6dd199ae067823286d",
"name": "Deangelo Kassulke",
"display_name": "Dr. Dalton Lebsack Jr.",
"description": "Atque ipsum quod fuga vel aut. ",
"created_at": "2016-05-02 09:35:41",
"updated_at": "2016-05-02 09:35:41"
},
{
"id": "57271f6dd199ae067823286e",
"name": "Kailyn Pagac V",
"display_name": "Diamond Emmerich",
"description": "Occaecati distinctio eius dignissimos porro est.",
"created_at": "2016-05-02 09:35:41",
"updated_at": "2016-05-02 09:35:41"
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
GET /api/features
Name | Type | Description |
---|---|---|
limit | integer | (optional, default: 20, maximum: 100) The maximum amount of records returned. |
from | datetime | (optional, default: 2015-01-01 ) The date and time limiting the beginning of returned records. E.g.: 2016-04-25 00:00:00 |
to | datetime | (optional, default: current Datetime) The date and time limiting the end of returned records. E.g.: 2016-04-26 00:00:00 |
order | string | (optional, default: desc) The order of the list returned. I.e.: desc (from earliest to latest), asc (from latest to earliest). |
GET /api/features/FEATURE_ID
POST /api/features
Name | Type | Description |
---|---|---|
name (maximum: 255, unique) | string | (required) Name of the feature. |
display_name (maximum: 255) | string | (required) Display name of the feature. |
description | string | (required) Description of the feature. |
PATCH /api/features/FEATURE_ID
Name | Type | Description |
---|---|---|
name (maximum: 255, unique) | string | (required) Name of the feature. |
display_name (maximum: 255) | string | (required) Display name of the feature. |
description | string | (required) Description of the feature. |
DELETE /api/features/FEATURE_ID