Skip to content

Example of RESTful Web Services for a phone book using vanilla PHP.

License

Notifications You must be signed in to change notification settings

andreipa/digital-api-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AND Digital API v0.1.0

License: MIT Build Status

About

Example of RESTful Web Services using vanilla PHP

How to use

List all customers


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"] }, {...} }]
  • Sample Call:

    http:https://YOURLOCALHOST/digital-api-php/api/v1/customers

Show customer


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"] } }]
  • Sample Call:

    http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/1

Update an existing customer


  • 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
  • Sample Call:

    http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/1

Add new customer


  • 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
  • Sample Call:

    http:https://YOURLOCALHOST/digital-api-php/api/v1/customers/

TO-DO

Create and fix PHPunit tests and Travis CI.

About

Example of RESTful Web Services for a phone book using vanilla PHP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages