AWS Serverless RESTful API
Serverless RESTful API created using Serverless with Feathers.
- Serverless (AWS Lambda) - Creating & Deploying serverless app
- FeathersJS (with Express) - Creating REST Api
- MongoDB - Database management
This project created in purpose to learn & experience creating a serverless service using AWS Lambda.
Below are API services created & available publicly to test. You may also find the API list via api.http file.
To see more detail on querying, go to feathers querying.
baseUrl : https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev
GET {{baseUrl}}/contact
Parameter | Type | Description |
---|---|---|
$sort |
object |
Optional. To sort return data based on specified field parameter. Acceptable value: (-1=descending) or (1=acending) |
$limit |
number |
Optional. To limit maximum number of record to return. |
fieldName |
string |
Optional. To filter record based on specified field parameters. |
Example request
GET {{baseUrl}}/contact?[$sort][firstName]=-1
CURL
curl -H "Content-type: application/json" 'https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev/contact?[$sort][firstName]=1'
GET {{baseUrl}}/contact/{{_id}}
Parameter | Type | Description |
---|---|---|
_id |
string |
Required. Records ID to get |
Example request
GET {{baseUrl}}/contact/61223baa61a88f9a00407358
CURL
curl -H "Content-type: application/json" 'https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev/contact/61223baa61a88f9a00407358'
POST {{baseUrl}}/contact
Parameter | Type | Description |
---|---|---|
firstName |
string |
Required. |
lastName |
string |
Required. |
phoneNumber |
string |
Required. |
email |
string |
Required. |
address |
string |
Required. |
birthDate |
string |
Required. Date format in DD-MM-YYYY |
Example request
POST {{baseUrl}}/contact
Acceptable request data:
{
"firstName" : string,
"lastName" : string,
"phoneNumber" : string,
"email" : string,
"address" : string,
"birthDate" : string //with format (DD-MM-YYYY)
}
CURL
curl -X POST -H "Content-type: application/json" -d '{
"firstName": "Test",
"lastName": "User",
"phoneNumber": "60123456610",
"email": "[email protected]",
"address": "Selangor",
"birthDate": "19-06-1991"
}' 'https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev/contact'
PATCH {{baseUrl}}/contact?_id={{_id}}
Parameter | Type | Description |
---|---|---|
_id |
string |
Required. Records ID to update |
firstName |
string |
Optional. |
lastName |
string |
Optional. |
phoneNumber |
string |
Optional. |
email |
string |
Optional. |
address |
string |
Optional. |
birthDate |
string |
Optional. Date format in DD-MM-YYYY |
Example request
PATCH {{baseUrl}}/contact?_id=61223baa61a88f9a00407358
CURL
curl -X PATCH -H "Content-type: application/json" -d '{
"address": "Cheras, Kuala Lumpur, Malaysia"
}' 'https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev/contact?_id=61223baa61a88f9a00407351'
Acceptable request data:
{
"firstName" : string,
"lastName" : string,
"phoneNumber" : string,
"email" : string,
"address" : string,
"birthDate" : string //with format (DD-MM-YYYY)
}
DELETE {{baseUrl}}/contact?_id={{_id}}
Parameter | Type | Description |
---|---|---|
_id |
string |
Required. Records ID to delete |
Example request
DELETE {{baseUrl}}/contact?_id=61223baa61a88f9a00407358
CURL
curl -X DELETE -H "Content-type: application/json" 'https://wtgqgtivzc.execute-api.ap-southeast-1.amazonaws.com/dev/contact?_id=6122fcda384444000828894e'
Successful request returns a JSON response in the following format:
{
"message" : string,
"status" : number,
"data" : object
}
For more information visit