A P I p p e r

A micro API framework for PHP
Reduces your entire API implementation to five optional method calls - one each for GET, POST, PUT, DELETE and OPTIONS!

- REST webservice calls        
- Supports all request types - GET / POST / PUT / DELETE / OPTIONS        
    - Response for the REST request type, OPTIONS is autogenerated as a fallback implementation             
- Query Param / Path Param         
    - Path Params can be of the type /key1/value1/key2/value2, or /value1/value2
- Isolates API implementations        
- Returns JSON or XML    
    - Parameters accepted as a URL PathParam / QueryParam. Also looks for HTTP ACCEPT headers if appropriate parameters are not found       
    - Defaults to JSON            
- Response headers obey error codes      
- SOAP / REST (TDB)        
- Utility methods        
    - GetDictionary - Get parameters as key-value pairs irrespective of whether Query/Path parameters are passed


##Reserved keywords:        
resource (required) - Specifies the API resource to call (The PHP file placed under /resources)        
format (optional) - Specifies the format to return data. Defaults to JSON


$response['code'] = 1 (Success) / 0 (Error) / 2 (Not Found)                
$response['data'] = API Response        
$response['message'] = Textual representation of 'code'

Example URLs:

    http://localhost/APIpper/api-endpoints/{resource-name}/{optional:format - xml/json}/{optional:parameters - QueryParams or PathParams}        
- GET: http://localhost/APIpper/api-endpoints/age - Returns JSON (default)      
- GET: http://localhost/APIpper/api-endpoints/age - Returns XML if HTTP HEADERS specifies XML       
- PUT: http://localhost/APIpper/api-endpoints/age/json                
- POST: http://localhost/APIpper/api-endpoints/age/any/other/parameters        
- POST: http://localhost/APIpper/api-endpoints/age/xml/key1/value1/key2/value2            
- DELETE: http://localhost/APIpper/api-endpoints/age/json/?key1=value1&key2=value2                     
- OPTIONS: http://localhost/APIpper/api-endpoints/age/json/

See '/sample-requests' for more examples


- Deploy on a PHP webroot   
- Edit /api-endpoints/.htaccess to reflect relative path to webroot     
- Try out any of the URI mentioned above    
- Write your own API at /api-endpoints/resources/   
- Check out sample API requests at, /sample-requests/