API ini menggunakan basic auth dengan default username
admin
dan passwordadmin
Disarankan menggunakan header
Content-Type: application/json
Menampilkan list semua contact
-
URL Params:
filter=[string]
: Filter untuk menampilkan data dengan sytax mongodbexample :
GET /contact?filter={"company":{"$regex":"oogl"}}
-
Data Params:
none
-
Success Response:
- Code: 200
Content:[ { "_id": "57dab6c89e30bcec0725c9e1", "name": "Setyo", "title": "CEO", "email": "setyo@bigcompany.com", "phone": "087730271408", "address": "Jl. Mawar No.3", "company": "Big Company" }, { "_id": "57e00ae8825673d3448651c6", "name": "John", "title": "Manager", "email": "setyo@bigcompany.com", "phone": "087730271408", "address": "Jl. Google no 2", "company": "Big Company" } ]
- Code: 200
-
Error Response:
- Code: 500
Content:
{ "error": 500, "message": "Internal Server Error" }
- Code: 500
Menampilkan id contact
-
URL Params:
none
-
Data Params:
none
-
Success Response:
- Code: 200
Content:{ "_id": "57dab6c89e30bcec0725c9e1", "name": "Setyo", "title": "CEO", "email": "setyo@bigcompany.com", "phone": "087730271408", "address": "Jl. Mawar No.3", "company": "Big Company" }
- Code: 200
-
Error Response:
- Code: 500
Content:
{ "error": 500, "message": "Internal Server Error" }
OR
- Code: 404
Content:
{ "error": 404, "message": "Contact not found" }
- Code: 500
Menambahkan data ke contact
-
URL Params:
none
-
Data Params:
name=[string]
title=[string]
email=[string]
phone=[string]
address=[string]
company=[string]
example:
{ "name": "Setyo Nugroho", "title": "CEO", "email": "setyo@bigcompany.com", "phone": "087730271408", "address": "My Home address", "company": "Big Company" }
-
Success Response:
- Code: 200
Content:Inserted data with id
- Code: 200
-
Error Response:
- Code: 500
Content:
{ "error": 500, "message": "Internal Server Error" }
- Code: 500
Mengubah data
-
URL Params:
none
-
Data Params:
name=[string]
title=[string]
email=[string]
phone=[string]
address=[string]
company=[string]
example:
{ "name": "Setyo Nugroho", "title": "CEO", "email": "setyo@bigcompany.com", "phone": "087730271408", "address": "My Home address", "company": "Big Company" }
-
Success Response:
- Code: 200
Content:{ "ok": 1, "nModified": 1, "n": 1 }
- Code: 200
-
Error Response:
- Code: 500
Content:
{ "error": 500, "message": "Internal Server Error" }
OR
- Code: 404
Content:
{ "error": 404, "message": "Contact not found" }
- Code: 500
Menghapus contact
-
URL Params:
none
-
Data Params:
none
-
Success Response:
- Code: 200
Content:{ "ok": 1, "n": 1 }
- Code: 200
-
Error Response:
- Code: 500
Content:
{ "error": 500, "message": "Internal Server Error" }
OR
- Code: 404
Content:
{ "error": 404, "message": "Contact not found" }
- Code: 500