### GET bookings by email request examples Source: https://flexopus.com/api/docs Examples of how to perform the GET request using various tools and languages. Requires an Authorization header with a Bearer token. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/users/by-email/hroberts@example.org/bookings?from=2021-11-01T00%3A00%3A00Z&to=2021-11-03T00%3A00%3A00Z" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://flexopus.com/api/v1/users/by-email/hroberts@example.org/bookings" ); const params = { "from": "2021-11-01T00:00:00Z", "to": "2021-11-03T00:00:00Z", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/users/by-email/hroberts@example.org/bookings'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], 'query' => [ 'from' => '2021-11-01T00:00:00Z', 'to' => '2021-11-03T00:00:00Z', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://flexopus.com/api/v1/users/by-email/hroberts@example.org/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/users/{id} request examples Source: https://flexopus.com/api/docs Examples of how to perform a GET request to retrieve user data using various programming languages and tools. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/users/1" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://flexopus.com/api/v1/users/1" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/users/1'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://flexopus.com/api/v1/users/1' headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers) response.json() ``` -------------------------------- ### GET api/v1/inventory/bookings Python requests Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/inventory/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-06T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/inventory/bookings JavaScript fetch request Source: https://flexopus.com/api/docs Example request using the JavaScript fetch API. ```javascript const url = new URL( "https://flexopus.com/api/v1/inventory/bookings" ); const params = { "from": "2021-11-01T00:00:00Z", "to": "2021-11-06T00:00:00Z", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### GET api/v1/bookings Python requests Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/inventory/bookings curl request Source: https://flexopus.com/api/docs Example request using curl to fetch inventory bookings. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/inventory/bookings?from=2021-11-01T00%3A00%3A00Z&to=2021-11-06T00%3A00%3A00Z" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### Example 200 response for GET api/v1/events/today Source: https://flexopus.com/api/docs Example JSON response with a data array containing event objects. Each event includes id, name, description, times, timezones, classification, status, organizer, attendees, and bookables. ```json { "data": [ { "id": 18794, "name": "Morning meeting", "description": "Morning status meeting." "from": "2021-11-02T06:00:00.000000Z", "from_timezone": "Europe/Berlin", "to": "2021-11-02T06:30:00.000000Z", "to_timezone": "Europe/Berlin", "classification": 0, "status": 1, "organizer": { "name": "Dr. Eddie Torphy IV" }, "attendees": [ { "id": 24, "name": "Meeting room 22", "email": "meeting-room-22@rooms.example.com", "role": 1, "status": 1 } ], "bookables": [ { "id": 24, "name": "Meeting room 22", "tags": [], "capacity": 6, "integration_email": "meeting-room-22@rooms.example.com" } ] }, { "id": 21794, "name": "Super important meeting" "description": "Everybody should bring their notes!" "from": "2021-11-04T08:00:00.000000Z", "from_timezone": "Europe/Berlin", "to": "2021-11-04T14:00:00.000000Z", "to_timezone": "Europe/Berlin", "classification": 0, "status": 1, "organizer": { "name": "Lillie Bergnaum" }, "attendees": [ { "id": 23, "name": "Meeting room 21", "email": "meeting-room-21@rooms.example.com", "role": 1, "status": 1 }, { "id": 24, "name": "Meeting room 22", "email": "meeting-room-22@rooms.example.com", "role": 2, "status": 2 }, ], "bookables": [ { "id": 23, "name": "Meeting room 21", "tags": [ "projector", "markers" ], "capacity": 12, "integration_email": "meeting-room-21@rooms.example.com" }, { "id": 24, "name": "Meeting room 22", "tags": [], "capacity": 6, "integration_email": "meeting-room-22@rooms.example.com" } ] } ] } ``` -------------------------------- ### GET api/v1/groups request using Python Source: https://flexopus.com/api/docs Example request to retrieve groups using the requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/groups' headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers) response.json() ``` -------------------------------- ### GET user by email using Python Requests Source: https://flexopus.com/api/docs Example request using the Python requests library to retrieve user information. ```python import requests import json url = 'https://flexopus.com/api/v1/users/by-email/fsanford@example.org' headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers) response.json() ``` -------------------------------- ### GET api/v1/bookings JavaScript fetch request Source: https://flexopus.com/api/docs Example request using the JavaScript fetch API to retrieve bookings. ```javascript const url = new URL( "https://flexopus.com/api/v1/bookings" ); const params = { "from": "2021-11-01T00:00:00Z", "to": "2021-11-03T00:00:00Z", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### cURL Request for Inventory Bookings Source: https://flexopus.com/api/docs Example cURL command to retrieve bookings for an inventory item using the GET method. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/inventory/est/bookings?from=2021-11-01T00%3A00%3A00Z&to=2021-11-03T00%3A00%3A00Z" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### GET api/v1/buildings JavaScript fetch request Source: https://flexopus.com/api/docs Example request using the JavaScript fetch API to retrieve building data. ```javascript const url = new URL( "https://flexopus.com/api/v1/buildings" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### curl request for GET api/v1/inventory/items Source: https://flexopus.com/api/docs Example curl command to fetch inventory items. Requires an Authorization header with a bearer token and Accept header set to application/json. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/inventory/items" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### GET user by email using JavaScript Fetch Source: https://flexopus.com/api/docs Example request using the JavaScript fetch API to retrieve user information. ```javascript const url = new URL( "https://flexopus.com/api/v1/users/by-email/fsanford@example.org" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### Python Requests for Building Bookings Source: https://flexopus.com/api/docs Example using the requests library to retrieve building bookings. ```python import requests import json url = 'https://flexopus.com/api/v1/buildings/1/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/bookings 200 response Source: https://flexopus.com/api/docs Example JSON response body for a successful GET request. ```json { "data": [ { "id": 18556, "from": "2021-11-01T08:00:00.000000Z", "to": null, "all_day": false, "livemap": "https://flexopus.com/api/v1/bookings/18556/livemap", "bookable": { "id": 445, "name": "Parking spot 2", "type": 1, // 0 => Desk, 1 => Parking spot, 2 => Meeting room, 3 => Home office "status": 0 // 0 => Flexible, 1 => Blocked, 2 => Assigned "capacity" => 1, "tags": [], "location": { "id": 32, "name": "Car park 4", "code": "P4", "building": { "id": 1, "name": "Building", "address": "281 Buchanan Rd, Sheffield, CH2 3NH" } } }, "user": { "id": 127, "name": "Lillie Bergnaum", "email": "lillie.bergnaum@example.com", "extensionAttributes": { "extensionAttribute3": "other value" } }, "guest": null, "license_plate": "AB-CD-123" }, { "id": 18596, "from": "2021-11-02T08:00:00.000000Z", "to": "2021-11-02T14:00:00.000000Z", "all_day": false, "livemap": "https://flexopus.com/api/v1/bookings/18596/livemap", "bookable": { "id": 23, "name": "Table 12", "type": 0, // 0 => Desk, 1 => Parking spot, 2 => Meeting room, 3 => Home office "status": 0 // 0 => Flexible, 1 => Blocked, 2 => Assigned "capacity" => 1, "tags": [], "location": { "id": 36, "name": "Office 34", "code": "O34", "building": { "id": 1, "name": "Building", "address": "281 Buchanan Rd, Sheffield, CH2 3NH" } } }, "user": { "id": 123, "name": "Dr. Eddie Torphy IV", "email": "dr.eddie.torphy.iv@example.com", "extensionAttributes": { "extensionAttribute1": "value" } }, "guest": "Irwin Muller" } ] } ``` -------------------------------- ### GET api/v1/groups response (200) Source: https://flexopus.com/api/docs Example successful response body for the GET api/v1/groups request. ```json { "data": [ { "id": 41, "name": "Team One" }, { "id": 56, "name": "Team Two" } ] } ``` -------------------------------- ### Python Requests for Inventory Bookings Source: https://flexopus.com/api/docs Example using the requests library to retrieve inventory bookings. ```python import requests import json url = 'https://flexopus.com/api/v1/inventory/est/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### POST api/v1/bookings request examples Source: https://flexopus.com/api/docs Examples of how to perform a POST request to the bookings endpoint using various tools and languages. ```bash curl --request POST \ "https://flexopus.com/api/v1/bookings" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data "{ \"bookable_id\": 30, \"from_time\": \"2023-08-16T13:00:00.000000Z\", \"to_time\": \"2023-08-16T16:00:00.000000Z\", \"user_id\": 10, \"location_id\": 4, \"guest_email\": \"johndoe@flexopus.com\", \"guest_name\": \"John Doe\", \"booking_info\": \"Meeting with John\", \"user_vehicle_id\": 1 }" ``` ```javascript const url = new URL( "https://flexopus.com/api/v1/bookings" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", "Content-Type": "application/json", }; let body = { "bookable_id": 30, "from_time": "2023-08-16T13:00:00.000000Z", "to_time": "2023-08-16T16:00:00.000000Z", "user_id": 10, "location_id": 4, "guest_email": "johndoe@flexopus.com", "guest_name": "John Doe", "booking_info": "Meeting with John", "user_vehicle_id": 1 }; fetch(url, { method: "POST", headers, body: JSON.stringify(body), }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/bookings'; $response = $client->post( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], 'json' => [ 'bookable_id' => 30, 'from_time' => '2023-08-16T13:00:00.000000Z', 'to_time' => '2023-08-16T16:00:00.000000Z', 'user_id' => 10, 'location_id' => 4, 'guest_email' => 'johndoe@flexopus.com', 'guest_name' => 'John Doe', 'booking_info' => 'Meeting with John', 'user_vehicle_id' => 1, ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://flexopus.com/api/v1/bookings' payload = { "bookable_id": 30, "from_time": "2023-08-16T13:00:00.000000Z", "to_time": "2023-08-16T16:00:00.000000Z", "user_id": 10, "location_id": 4, "guest_email": "johndoe@flexopus.com", "guest_name": "John Doe", "booking_info": "Meeting with John", "user_vehicle_id": 1 } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json', 'Content-Type': 'application/json' } response = requests.request('POST', url, headers=headers, json=payload) response.json() ``` -------------------------------- ### Python requests request for GET api/v1/inventory/items Source: https://flexopus.com/api/docs Example Python code using the requests library to send a GET request to the inventory items endpoint. Prints the JSON response. ```python import requests import json url = 'https://flexopus.com/api/v1/inventory/items' headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers) response.json() ``` -------------------------------- ### JavaScript Fetch Request for Building Bookings Source: https://flexopus.com/api/docs Example using the Fetch API to retrieve building bookings. ```javascript const url = new URL( "https://flexopus.com/api/v1/buildings/1/bookings" ); const params = { "from": "2021-11-01T00:00:00Z", "to": "2021-11-03T00:00:00Z", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### GET api/v1/inventory/bookings 200 response Source: https://flexopus.com/api/docs Example JSON response body for a successful request. ```json { "data": [ { "id": "01ks7h86apf0qeyj9k2xa0vgqf", "from": "2026-05-22T09:46:17.000000Z", "to": null, "timezone": "UTC", "status": 0, "user": { "id": 2, "name": "Gert Peters", "email": "gerpeter@example.org", "extensionAttributes": [] }, "inventory_item": { "identifier": "VERO_9370732", "name": "Apple MacBook Air 13 inch 2015", "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Restricted "producer_name" => "Neuhaus", "serial_number" => "44754/on/317", "production_date" => "2007-02-07T00:00:00.000000Z", "purchase_date" => "2026-05-09T00:00:00.000000Z", "price" => 18.5, "ownership" => 0, // 0 => Leased, 1 => Bought "expiration_date" => "2027-05-09T00:00:00.000000Z", "category": { "id": 1, "name": "Car" }, "attached": { "id": 3, "name": "Berlin Office (Large)", "timezone": "Europe/Berlin", "address": "5/3 Schülerstraße, Berlin, 33080" }, "attached_type": "building", "attached_description": null }, "additional_fields": null }, { "id": "01kshj5qcgrqq3tt6pcm7jhwcq", "from": "2026-05-26T07:00:00.000000Z", "to": "2026-05-28T07:00:00.000000Z", "timezone": "Europe/Berlin", "status": 0, "user": { "id": 54, "name": "Annelies Hinz", "email": "mkremer@example.net", "extensionAttributes": [] }, "inventory_item": { "identifier": "SED_298876", "name": "Monitor Full HD LCD 27E1N1300A/00 | Philips", "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Restricted "producer_name" => "Neuhaus", "serial_number" => "44754/on/317", "production_date" => "2007-02-07T00:00:00.000000Z", "purchase_date" => "2026-05-09T00:00:00.000000Z", "price" => 18.5, "ownership" => 1, // 0 => Leased, 1 => Bought "expiration_date" => null, "category": { "id": 5, "name": "Category asperiores" }, "attached": null, "attached_type": null, "attached_description": null }, "additional_fields": { "need-cabel": true } } ] } ``` -------------------------------- ### Python Requests for bookable availability Source: https://flexopus.com/api/docs A Python example using the requests library to query bookable availability. ```python import requests import json url = 'https://flexopus.com/api/v1/bookables/availability' payload = { "from": "2021-11-01T00:00:00Z", "to": "2021-11-03T00:00:00Z", "location_id": 4, "building_id": 2, "occupied": true, "tags": null, "capacity": 12, "per_page": 21 } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json', 'Content-Type': 'application/json' } response = requests.request('POST', url, headers=headers, json=payload) response.json() ``` -------------------------------- ### Import Users via Python Requests Source: https://flexopus.com/api/docs Example request using the Python requests library to import users. ```python import requests import json url = 'https://flexopus.com/api/v1/users/import' files = { 'update': (None, '1'), 'dry_run': (None, '1'), 'file': open('/tmp/php8r17pcdhe9n1edci1jH', 'rb')} payload = { "update": true, "dry_run": true } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json', 'Content-Type': 'multipart/form-data' } response = requests.request('POST', url, headers=headers, files=files) response.json() ``` -------------------------------- ### GET api/v1/events Python requests Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/events' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-06T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Python requests for occupancy Source: https://flexopus.com/api/docs Example Python implementation using the requests library to retrieve occupancy data. ```python import requests import json url = 'https://flexopus.com/api/v1/locations/2/bookables/occupancy' headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers) response.json() ``` -------------------------------- ### Python Requests for User Bookings Source: https://flexopus.com/api/docs Example request using the Python requests library to retrieve user bookings. ```python import requests import json url = 'https://flexopus.com/api/v1/users/1/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### PHP Guzzle request for GET api/v1/inventory/items Source: https://flexopus.com/api/docs Example PHP code using GuzzleHttp\Client to send a GET request to the inventory items endpoint. Prints the decoded JSON response body. ```php $client = new \GuzzleHttp\Client(); n$url = 'https://flexopus.com/api/v1/inventory/items'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### Import Users via cURL Source: https://flexopus.com/api/docs Example request using cURL to import users with multipart/form-data. ```bash curl --request POST \ "https://flexopus.com/api/v1/users/import" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" \ --header "Content-Type: multipart/form-data" \ --form "update=1"\ --form "dry_run=1"\ --form "file=@/tmp/php8r17pcdhe9n1edci1jH" ``` -------------------------------- ### GET api/v1/inventory/bookings/today Response Source: https://flexopus.com/api/docs Example JSON response returned by the API upon a successful request. ```json { "data": [ { "id": "01ks7h86apf0qeyj9k2xa0vgqf", "from": "2026-05-22T09:46:17.000000Z", "to": null, "timezone": "UTC", "status": 0, "user": { "id": 2, "name": "Gert Peters", "email": "gerpeter@example.org", "extensionAttributes": [] }, "inventory_item": { "identifier": "VERO_9370732", "name": "Apple MacBook Air 13 inch 2015", "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Restricted "producer_name" => "Neuhaus", "serial_number" => "44754/on/317", "production_date" => "2007-02-07T00:00:00.000000Z", "purchase_date" => "2026-05-09T00:00:00.000000Z", "price" => 18.5, "ownership" => 0, // 0 => Leased, 1 => Bought "expiration_date" => "2027-05-09T00:00:00.000000Z", "category": { "id": 1, "name": "Car" }, "attached": { "id": 3, "name": "Berlin Office (Large)", "timezone": "Europe/Berlin", "address": "5/3 Schülerstraße, Berlin, 33080" }, "attached_type": "building", "attached_description": null }, "additional_fields": null }, { "id": "01kshj5qcgrqq3tt6pcm7jhwcq", "from": "2026-05-26T07:00:00.000000Z", "to": "2026-05-28T07:00:00.000000Z", "timezone": "Europe/Berlin", "status": 0, "user": { "id": 54, "name": "Annelies Hinz", "email": "mkremer@example.net", "extensionAttributes": [] }, "inventory_item": { "identifier": "SED_298876", "name": "Monitor Full HD LCD 27E1N1300A/00 | Philips", "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Restricted "producer_name" => "Neuhaus", "serial_number" => "44754/on/317", "production_date" => "2007-02-07T00:00:00.000000Z", "purchase_date" => "2026-05-09T00:00:00.000000Z", "price" => 18.5, "ownership" => 1, // 0 => Leased, 1 => Bought "expiration_date" => null "category": { "id": 5, "name": "Category asperiores" }, "attached": null, "attached_type": null, "attached_description": null }, "additional_fields": { "need-cabel": true } } ] } ``` -------------------------------- ### Import Users via JavaScript Fetch Source: https://flexopus.com/api/docs Example request using the Fetch API to import users. ```javascript const url = new URL( "https://flexopus.com/api/v1/users/import" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", "Content-Type": "multipart/form-data", }; const body = new FormData(); body.append('update', '1'); body.append('dry_run', '1'); body.append('file', document.querySelector('input[name="file"]').files[0]); fetch(url, { method: "POST", headers, body, }).then(response => response.json()); ``` -------------------------------- ### JavaScript fetch request for occupancy Source: https://flexopus.com/api/docs Example JavaScript fetch implementation to retrieve occupancy data. ```javascript const url = new URL( "https://flexopus.com/api/v1/locations/2/bookables/occupancy" ); const headers = { "Authorization": "Bearer {YOUR_API_TOKEN}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### GET api/v1/events 200 OK response Source: https://flexopus.com/api/docs Example JSON response body for a successful request. ```json { "data": [ { "id": 18794, "name": "Morning meeting" "from": "2021-11-02T06:00:00.000000Z", "to": "2021-11-02T06:30:00.000000Z", "organizer": { "name": "Dr. Eddie Torphy IV" }, "bookables": [ { "id": 24, "name": "Meeting room 22", "tags": [], "capacity": 6, "integration_email": "meeting-room-22@rooms.example.com" } ] }, { "id": 21794, "name": "Super important meeting" "from": "2021-11-04T08:00:00.000000Z", "to": "2021-11-04T14:00:00.000000Z", "organizer": { "name": "Lillie Bergnaum" }, "bookables": [ { "id": 23, "name": "Meeting room 21", "tags": [ "projector", "markers" ], "capacity": 12, "integration_email": "meeting-room-21@rooms.example.com" }, { "id": 24, "name": "Meeting room 22", "tags": [], "capacity": 6, "integration_email": "meeting-room-22@rooms.example.com" } ] } ] } ``` -------------------------------- ### Export users via Python requests Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/users/export' params = { 'format': 'csv', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/buildings curl request Source: https://flexopus.com/api/docs Example request using curl to retrieve building data. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/buildings" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### Import Users via PHP Guzzle Source: https://flexopus.com/api/docs Example request using the Guzzle HTTP client to import users. ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/users/import'; $response = $client->post( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', 'Content-Type' => 'multipart/form-data', ], 'multipart' => [ [ 'name' => 'update', 'contents' => '1' ], [ 'name' => 'dry_run', 'contents' => '1' ], [ 'name' => 'file', 'contents' => fopen('/tmp/php8r17pcdhe9n1edci1jH', 'r') ], ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### GET api/v1/groups request using PHP Source: https://flexopus.com/api/docs Example request to retrieve groups using GuzzleHttp. ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/groups'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### Python Requests for Bookings Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/bookables/1/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### GET api/v1/groups request using cURL Source: https://flexopus.com/api/docs Example request to retrieve groups using cURL. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/groups" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### Example response (200) Source: https://flexopus.com/api/docs The expected response body for a successful request. ```text A file containing the user export in the requested format. ``` -------------------------------- ### GET api/v1/inventory/bookings PHP Guzzle request Source: https://flexopus.com/api/docs Example request using the PHP Guzzle HTTP client. ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/inventory/bookings'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], 'query' => [ 'from' => '2021-11-01T00:00:00Z', 'to' => '2021-11-06T00:00:00Z', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### Example JSON Response (200) Source: https://flexopus.com/api/docs A successful response containing a list of booking objects. ```json { "data": [ { "id": 18552, "from": "2021-11-01T08:00:00.000000Z", "to": "2021-11-01T10:00:00.000000Z", "livemap": "https://flexopus.com/api/v1/bookings/18552/livemap", "bookable": { "id": 113, "name": "Table 24", "type": 0, // 0 => Desk, 1 => Parking spot, 2 => Meeting room, 3 => Home office "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Assigned "tags": [], "capacity": null, "location": { "id": 36, "name": "Office 34", "code": "O34" } }, "user": { "id": 123, "name": "Dr. Eddie Torphy IV", "email": "dr.eddie.torphy.iv@example.com", "extensionAttributes": { "extensionAttribute1": "value" } }, "guest": null }, { "id": 13862, "from": "2021-11-01T14:00:00.000000Z", "to": null, "livemap": "https://flexopus.com/api/v1/bookings/13862/livemap", "bookable": { "id": 445, "name": "Parking spot 2", "type": 1, // 0 => Desk, 1 => Parking spot, 2 => Meeting room, 3 => Home office "status": 0, // 0 => Flexible, 1 => Blocked, 2 => Assigned "tags": [], "capacity": null, "location": { "id": 32, "name": "Car park 4", "code": "P4" } }, "user": { "id": 127, "name": "Lillie Bergnaum", "email": "lillie.bergnaum@example.com", "extensionAttributes": { "extensionAttribute3": "other value" } }, "guest": null, "license_plate": null } ] } ``` -------------------------------- ### GET api/v1/bookings PHP Guzzle request Source: https://flexopus.com/api/docs Example request using the PHP Guzzle HTTP client. ```php $client = new \GuzzleHttp\Client(); $url = 'https://flexopus.com/api/v1/bookings'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_API_TOKEN}', 'Accept' => 'application/json', ], 'query' => [ 'from' => '2021-11-01T00:00:00Z', 'to' => '2021-11-03T00:00:00Z', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### cURL Request for Bookings Source: https://flexopus.com/api/docs Example request using cURL to fetch bookings for a bookable. ```bash curl --request GET \ --get "https://flexopus.com/api/v1/bookables/1/bookings?from=2021-11-01T00%3A00%3A00Z&to=2021-11-03T00%3A00%3A00Z" \ --header "Authorization: Bearer {YOUR_API_TOKEN}" \ --header "Accept: application/json" ``` -------------------------------- ### Python Requests for Location Bookings Source: https://flexopus.com/api/docs Example request using the Python requests library. ```python import requests import json url = 'https://flexopus.com/api/v1/locations/17/bookings' params = { 'from': '2021-11-01T00:00:00Z', 'to': '2021-11-03T00:00:00Z', } headers = { 'Authorization': 'Bearer {YOUR_API_TOKEN}', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ```