Example of RESTful Web Services using vanilla PHP
Returns json data with all customers.
-
URL
/customers
-
Method:
GET
-
URL Params
None
-
Data Params
None
-
Success Response:
- Code: 200
Content:[ { "id": 1, "token": "5c35e38fcc38022942e47a39", "registered": "2019-01-08 09:09:57", "updated": "2019-01-03 12:26:07", "name": "Kimberly Evans", "phones": [ "+44 (895) 571-3330", "+44 (928) 408-2446"] }, {...} }]
- Code: 200
-
Sample Call:
http:https://YOURLOCALHOST/digital-api-php/api/v1/customers
Returns json data about a single customer.
-
URL
/customers/:id
-
Method:
GET
-
URL Params
Required:
id=[integer]
-
Data Params
None
-
Success Response:
- Code: 200
Content:[ { "id": 1, "token": "5c35e38fcc38022942e47a39", "registered": "2019-01-08 09:09:57", "updated": "2019-01-03 12:26:07", "name": "Kimberly Evans", "phones": [ "+44 (895) 571-3330", "+44 (928) 408-2446"] } }]
- Code: 200
-
Sample Call:
http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/1
-
URL
/customers/:id
-
Method:
PUT
-
URL Params
Required:
id=[integer]
-
Data Params
Required
{ "name": "Andrei Andrade", "phones": [ { "id": 1, "isActive": true, "phone": "+55 347269477" } ] }
-
Success Response:
- Code: 200
- Code: 200
-
Sample Call:
http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/1
-
URL
/customers
-
Method:
POST
-
URL Params
None
-
Data Params
Required
{ "name": "Andrei Andrade", "phones": [ { "id": 1, "isActive": true, "phone": "+55 347269477" } ] }
-
Success Response:
- Code: 201
- Code: 201
-
Sample Call:
http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/
Create and fix PHPunit tests and Travis CI.