Introduction
Welcome to the Fotec API! You can use our API to book a photoshoot with our premium photographers in your area.
We have language bindings in Shell and PHP (more soon). You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Sandbox environment
We provide you a sandbox api for testing purposes:
http://api-sandbox.fotec.mx
In order to request a sandbox account email us to developers@fotec.mx with the following data: full name, email, contact phone and company name. We'll send you back a notification once your account is activated.
We have a internal process which "imitate" the state for your booking until is ready to download the photos. This job run every minute.
The photos availables for download came from a test folder created for this purpose. There are always the same.
Authentication
Our API uses Basic Auth to allow access to the API. You must use your customer's credentials: email and password.
The API expects for the authentication token to be included in all requests to the server in a header that looks like the following:
Authorization: Basic xxxxyyyyyyzzzzzzwwwww==
Bookings
Request a Booking
curl "https://api.fotec.mx/customers/bookings"
-H "Accept application/json"
-H "Authorization: Basic xxxxyyyyyyzzzzzzwwwww=="
-X POST -d '{
"address": "Blvd. Miguel de Cervantes Saavedra 303, Granada, Miguel Hidalgo, 11529 Ciudad de México, CDMX",
"booking_date": "2018-06-05",
"booking_time": "14:30",
"package_id": 4,
"comments": "Tomar fotos tanto del exterior como del interior",
"contact_name": "Juan Perez",
"contact_phone": "(111) 555-443322",
"meta": {
"latitude": "19.440145",
"longitude": "-99.204312"
}
}'
<?php
// using Guzzle as composer dependency
require_once 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.fotec.mx/customers/bookings',
[
'auth' => ['username', 'password'],
'json' => [
"address" => "Blvd. Miguel de Cervantes Saavedra 303, Granada, Miguel Hidalgo, 11529 Ciudad de México, CDMX",
"booking_date" => "2018-06-05",
"booking_time" => "14:30",
"package_id" => 4,
"comments" => "Tomar fotos tanto del exterior como del interior",
"contact_name" => "Juan Perez",
"contact_phone" => "(111) 555-443322",
"meta" => [
"latitude" => "19.440145",
"longitude" => "-99.204312"
]
]
]);
$body = $response->getBody();
The above command returns JSON structured like this:
{
"booking_number": "OSF-0000000123",
"booking_status": "Pending to confirm",
"booking_info": {
"location": "Blvd. Miguel de Cervantes Saavedra 303, Granada, Miguel Hidalgo, 11529 Ciudad de México, CDMX",
"schedule": "2018-06-05 14:30",
"comments": "Tomar fotos tanto del exterior como del interior"
},
"customer_info": {
"name": "Juan Perez",
"phone": "(111) 555-443322",
}
}
This endpoint creates a booking request.
HTTP Request
POST https://api.fotec.mx/customers/bookings
Parameters
address Is the location address for the booking. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 250 | Blvd. Miguel de Cervantes Saavedra 303, Granada, Miguel Hidalgo, 11529 Ciudad de México, CDMX |
booking_date The date for the booking. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 50 | 2017-03-18 |
booking_time The time for the booking. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 20 | 13:00 |
package_id The package ID associated with the booking. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| integer | required | 11 | 2 |
comments Additional info about the booking. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| text | required | 500 | Tomar fotos tanto del exterior como del interior |
contact_name The contact's full name. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 150 | Juan Perez |
contact_phone The contact's phone. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 150 | (111) 555-443322 |
latitude Is the latitude value from the provided location. Is not required but it's help to accurate booking.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | optional | 200 | 19.397891 |
longitud Is the longitud value from the provided location. Is not required but it's help to accurate booking.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | optional | 200 | -99.204312 |
Get a Booking Status
curl "https://api.fotec.mx/customers/bookings/OSF-000000123/status"
-H "Accept application/json"
-H "Authorization: Basic xxxxyyyyyyzzzzzzwwwww=="
<?php
// using Guzzle as composer dependency
require_once 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.fotec.mx/customers/bookings/OSF-000000123/status',
[
'auth' => ['username', 'password']
]);
$body = $response->getBody();
The above command returns JSON structured like this:
{
"booking_number": "OSF-000000123",
"booking_status_key": "delivered",
"booking_status_message": "Fotos disponibles para entrega",
"booking_status_update": "2018-06-20 12:00:00"
}
This endpoint retrieves a status for a booking.
The possibles states are:
| slug | description |
|---|---|
| new | En espera de asignación de un fotógrafo |
| assigned | Confirmada y a la espera de aceptación del fotógrafo |
| accepted | Confirmada y aceptada por el fotógrafo |
| uploaded | Material a espera de edición |
| editing | En proceso de edición |
| delivered | Fotos disponibles para entrega |
| cancelled | Sesión cancelada |
HTTP Request
GET https://api.fotec.mx/customers/bookings/<OSF>/status
Parameters
OSF The booking number. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 50 | OSF-000000123 |
Get a Booking Files
curl "https://api.fotec.mx/customers/bookings/OSF-000000123/photos"
-H "Accept application/json"
-H "Authorization: Basic xxxxyyyyyyzzzzzzwwwww=="
<?php
// using Guzzle as composer dependency
require_once 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.fotec.mx/customers/bookings/OSF-000000123/photos',
[
'auth' => ['username', 'password']
]);
$body = $response->getBody();
The above command returns JSON structured like this:
{
"booking_number": "OSF-000000123",
"booking_files": [
{
"url": "http://storage.domain.com/url_to_file_1",
"caption": "file_1.jpg",
"file_type": "image"
},
{
"url": "http://storage.domain.com/url_to_file_2",
"caption": "file_2.jpg",
"file_type": "image"
},
{
"url": "http://storage.domain.com/url_to_file_3",
"caption": "file_3.jpg",
"file_type": "image"
}
],
"expiration_date": 1526252585
}
This endpoint retrieves the photos associated to the photoshoot.
HTTP Request
GET https://api.fotec.mx/customers/bookings/<OSF>/photos
Parameters
OSF The booking number. Is required.
| Type | Ocurrence | Longitud | Example |
|---|---|---|---|
| string | required | 50 | OSF-000000123 |
Errors
The Fotec API uses the following error codes:
| Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request sucks. |
| 401 | Unauthorized -- Your API token is wrong. |
| 403 | Forbidden -- The resource requested is hidden for administrators only. |
| 404 | Not Found -- The specified resource could not be found. |
| 405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
| 429 | Too Many Requests -- You're requesting too many resources! Slow down! |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |