We’re happy to announce the release of FreePHS API(Beta). With the API you can now access vehicle and booking data.
GET YOUR API KEY:
Login to FreePHS, go to Settings -> Company and obtain your key.
ENDPOINT URL:
http://{yourdomain}.freephs.com/api
AUTHENTIFICATION:
An authentication is made simple, just pass your api key at every request.
http://{yourdomain}.freephs.com/api/api-method?apikey={your_api_key}
API METHODS:
1. Get All Vehicle Categories
REQUEST:
GET /api/vehicle/cats?apikey={your_api_key}
RESPONSE:
HTTP/1.1 200 OK Content-Type: application/json
{ "cats": [{ "id": 152, "name": "BMW 5 OR SIMILAR", "capacity": 4, "notes": "2 PASSENGERS WITH LUGGAGE OR 4 WITHOUT Leather Seating, Air Con, Complimentary Wi-Fi", "image": null }, { "id": 153, "name": "BMW GT OR SIMILAR", "capacity": 4, "notes": "2 PASSENGERS WITH LUGGAGE OR 4 WITHOUT Leather Interior, Complimentary Wi-Fi, Air Con", "image": null }, { "id": 154, "name": "BMW 7 OR SIMILAR", "capacity": 4, "notes": "2 PASSENGERS WITH LUGGAGE OR 4 WITHOUT Long Wheel Base, Leather Interior, Complimentary Wi-Fi, Air Con", "image": null }] }
2. Create New Quote
REQUEST:
POST /api/quote/?apikey={your_api_key} Content-Length: 277 Content-Type: application/x-www-form-urlencoded phs_rest_new_quote[pickup]=Heathrow&phs_rest_new_quote[destination]=London&phs_rest_new_quote[startDate]=2014-02-13 14:00:00&phs_rest_new_quote[customer][firstName]=John Doe&phs_rest_new_quote[customer][email]=johndoe@example.com&phs_rest_new_quote[customer][phone]=+4400000000
RESPONSE:
HTTP/1.1 201 Created Location: http://{yourdomain}.freephs.com/api/quote/167 Content-Type: application/json
3. Get Quote
REQUEST:
GET /api/quote/167?apikey={your_api_key}
RESPONSE:
HTTP/1.1 200 OK Content-Type: application/json
{ "quote": { "id": 167, "price": "27.05", "pickup": "Heathrow", "destination": "London", "startDate": { "date": "2014-02-13 14:00:00", "timezone_type": 3, "timezone": "UTC" } } }
4. Delete Quote
REQUEST:
DELETE /api/quote/167?apikey={your_api_key}
RESPONSE:
HTTP/1.1 204 No Content