### Install and Run Slate Locally Source: https://github.com/besttime-app/slate/blob/master/README.md This snippet demonstrates the shell commands to install dependencies and start the Slate documentation server locally. It requires Ruby and Bundler to be pre-installed. The server will be accessible at http://localhost:4567. ```shell # either run this to run locally bundle install bundle exec middleman server ``` -------------------------------- ### Initialize and Start Slate with Vagrant Source: https://github.com/besttime-app/slate/blob/master/README.md This snippet shows the shell command to start the Slate documentation server using Vagrant. This approach is an alternative to running locally and requires Vagrant to be installed. The server will be accessible at http://localhost:4567. ```shell # OR run this to run with vagrant vagrant up ``` -------------------------------- ### Authenticate with API Key (Python, cURL, JavaScript) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_apireference.md Demonstrates how to authenticate with the BestTime.app API using a private API key. This involves making a GET request to the API endpoint. It includes examples in Python, cURL, and JavaScript, and shows the expected JSON response format for authentication. ```python import requests url = "https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122" response = requests.request("GET", url) print(response.json()) ``` ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122' ``` ```javascript fetch(`https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### Venue Search Response Example Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenuessearch.md An example JSON response from the Venue Search endpoint, illustrating the structure and key fields such as '_links', 'collection_id', 'job_id', and 'status'. This response includes a link to track the background job for venue search progress. ```json { "_links": { "venue_search_progress": "https://besttime.app/api/v1/venues/progress?job_id=e0880f28-3a19-4871-a355-4ca21f10c2c8&collection_id=col_ac734e76ad2d4696a5a66541c67587e8&format=raw" }, "collection_id": "col_ac734e76ad2d4696a5a66541c67587e8", "job_id": "e0880f28-3a19-4871-a355-4ca21f10c2c8", "status": "OK" } ``` -------------------------------- ### Query Week Overview with cURL Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsweekoverview.md This example shows how to request the week overview data from the BestTime App API using a cURL command. It includes the necessary public API key and venue ID as query parameters in the GET request URL. ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/forecasts/weekoverview?api_key_public=pub_e11661721b084d36b8f469a2c012e754&venue_id=ven_51387131543761435650505241346a394a6432395362654a496843' ``` -------------------------------- ### Venues Update Endpoint Example (JSON Response) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenuesupdate.md Example JSON response from the Venues Update endpoint. It includes a message, status, a list of venues with their details, and the total count of venues. ```json { "message": "Venues with foot traffic data older than 2 week(s). Listed venues will not be updated. Set 'update=true' to create a new foot traffic forecast for each individual venue (normal 'new foot traffic forecast' API credits apply for each venue)", "status": "OK", "venues": [ [ "1201 Ocean Ave San Francisco, CA 94112 United States", "ven_51387131543761435650505241346a394a6432395362654a496843", "2021-03-05 04:37AM" ],.... ], "venues_n": 298 } ``` -------------------------------- ### Example JSON Response for Query Peaks Source: https://github.com/besttime-app/slate/blob/master/combined_documentation.md This is an example of the JSON response returned by the 'query peaks' endpoint. It contains venue information, analysis details including peak hours ('peak_hours' and 'peaks_coming'), and epoch analysis time. ```json { "analysis": { "day_info": { "day_int": 1, "day_rank_max": 2, "day_rank_mean": 4, "day_text": "Tuesday", "venue_closed": 4, "venue_open": 4 }, "peak_hours": [ { "peak_delta_mean_week": 37, "peak_end": 18, "peak_end_12h": "6PM", "peak_end_in": "2 hour and 40 minutes", "peak_end_in_sec": 9660, "peak_end_passed": 0, "peak_intensity": 5, "peak_max": 13, "peak_max_12h": "1PM", "peak_max_in": "Peak maximum already passed", "peak_max_in_sec": 0, "peak_max_passed": 1, "peak_start": 7, "peak_start_12h": "7AM", "peak_start_in": "Peak already started", "peak_start_in_sec": 9660, "peak_start_passed": 1 }, { "peak_delta_mean_week": 12, "peak_end": 23, "peak_end_12h": "11PM", "peak_end_in": "7 hour and 41 minutes", "peak_end_in_sec": 27660, "peak_end_passed": 0, "peak_intensity": 3, "peak_max": 21, "peak_max_12h": "9PM", "peak_max_in": "5 hour and 41 minutes", "peak_max_in_sec": 20460, "peak_max_passed": 0, "peak_start": 18, "peak_start_12h": "6PM", "peak_start_in": "2 hour and 40 minutes", "peak_start_in_sec": 9660, "peak_start_passed": 0 } ] }, "epoch_analysis": 1583400856, "forecast_updated_on": "2020-03-05T09:34:16.842016+00:00", "status": "OK", "venue_info": { "venue_current_gmttime": "Tue, 10 Mar 2020 22:19:56 GMT", "venue_current_localtime_iso": "2020-03-10T15:19:56.979659-07:00", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's", "venue_timezone": "America/Los_Angeles" } } ``` -------------------------------- ### Example JSON Response for Peak Hours Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointspeakhours.md This is an example of the JSON response structure received when querying peak hours from the BestTime App API. It details venue information and analysis of peak activity. ```json { "analysis": { "day_info": { "day_int": 1, "day_rank_max": 2, "day_rank_mean": 4, "day_text": "Tuesday", "venue_closed": 4, "venue_open": 4 }, "peak_hours": [ { "peak_delta_mean_week": 37, "peak_end": 18, "peak_end_12h": "6PM", "peak_end_in": "2 hour and 40 minutes", "peak_end_in_sec": 9660, "peak_end_passed": 0, "peak_intensity": 5, "peak_max": 13, "peak_max_12h": "1PM", "peak_max_in": "Peak maximum already passed", "peak_max_in_sec": 0, "peak_max_passed": 1, "peak_start": 7, "peak_start_12h": "7AM", "peak_start_in": "Peak already started", "peak_start_passed": 1 }, { "peak_delta_mean_week": 12, "peak_end": 23, "peak_end_12h": "11PM", "peak_end_in": "7 hour and 41 minutes", "peak_end_in_sec": 27660, "peak_end_passed": 0, "peak_intensity": 3, "peak_max": 21, "peak_max_12h": "9PM", "peak_max_in": "5 hour and 41 minutes", "peak_max_in_sec": 20460, "peak_max_passed": 0, "peak_start": 18, "peak_start_12h": "6PM", "peak_start_in": "2 hour and 40 minutes", "peak_start_in_sec": 9660, "peak_start_passed": 0 } ] }, "epoch_analysis": 1583400856, "forecast_updated_on": "2020-03-05T09:34:16.842016+00:00", "status": "OK", "venue_info": { "venue_current_gmttime": "Tue, 10 Mar 2020 22:19:56 GMT", "venue_current_localtime_iso": "2020-03-10T15:19:56.979659-07:00", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's", "venue_timezone": "America/Los_Angeles" } } ``` -------------------------------- ### Example JSON Response for Query Venues Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenues.md This is an example of the JSON response structure returned by the 'Query All Venues' endpoint. It contains a list of venue objects, each with details like address, forecast status, ID, and name. ```json [ { "venue_address": "1201 Ocean Ave San Francisco, CA 94112 United States", "venue_forecasted": true, "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's" } ] ``` -------------------------------- ### Example JSON Response for Quiet Hours Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsquiethours.md An example of the JSON response structure returned by the 'query quiet hours' endpoint. It includes venue information, analysis of quiet hours, and forecast update times. ```JSON { "analysis": { "day_info": { "day_int": 4, "day_rank_max": 7, "day_rank_mean": 3, "day_text": "Friday", "venue_closed": 4, "venue_open": 4 }, "quiet_hours": [ { "quiet_end": 8, "quiet_end_12": "8AM", "quiet_end_in": "End of quiet period already passed", "quiet_end_in_sec": 0, "quiet_end_passed": 1, "quiet_period_duration": 2, "quiet_start": 6, "quiet_start_12": "6AM", "quiet_start_in": "Start of quiet period already passed", "quiet_start_in_sec": 0, "quiet_start_passed": 1 }, { "quiet_end": 6, "quiet_end_12": "6AM", "quiet_end_in": "18 hour and 7 minutes", "quiet_end_in_sec": 65280, "quiet_end_passed": 0, "quiet_period_duration": 3, "quiet_start": 3, "quiet_start_12": "3AM", "quiet_start_in": "15 hour and 7 minutes", "quiet_start_in_sec": 54480, "quiet_start_passed": 0 } ], "quiet_hours_list": [ 6, 7, 3, 4, 5 ], "quiet_hours_list_12h": [ "6AM", "7AM", "3AM", "4AM", "5AM" ], "quiet_hours_list_coming": [ 3, 4, 5 ], "quiet_hours_list_coming_12h": [ "3AM", "4AM", "5AM" ] }, "epoch_analysis": 1583911633, "forecast_updated_on": "2020-03-11T07:27:13.849228+00:00", "status": "OK", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_info": { "venue_current_gmttime": "Fri, 13 Mar 2020 18:52:28 GMT", "venue_current_localtime_iso": "2020-03-13T11:52:28.890102-07:00", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's", "venue_timezone": "America/Los_Angeles" }, "venue_name": "McDonald's" } ``` -------------------------------- ### Surge Hours API Response Example Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsurge.md This is an example of a JSON response from the 'query surge hours' endpoint. It provides detailed analysis of surge hours, including when the most people come and leave, as well as venue information such as timezone and current local time. ```json { "analysis": { "day_info": { "day_int": 0, "day_rank_max": 5, "day_rank_mean": 5, "day_text": "Monday", "venue_closed": 4, "venue_open": 4 }, "surge_hours": { "most_people_come": 8, "most_people_come_12h": "8AM", "most_people_come_passed": 0, "most_people_come_start_in": "Most people are coming in now", "most_people_come_start_in_sec": 0, "most_people_leave": 1, "most_people_leave_12h": "1AM", "most_people_leave_passed": 0, "most_people_leave_start_in": "16 hour and 26 minutes", "most_people_leave_start_in_sec": 59160 } }, "epoch_analysis": 1583911633, "forecast_updated_on": "2020-03-11T07:27:13.841800+00:00", "status": "OK", "venue_info": { "venue_current_gmttime": "Mon, 16 Mar 2020 15:34:59 GMT", "venue_current_localtime_iso": "2020-03-16T08:34:59.778538-07:00", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's", "venue_timezone": "America/Los_Angeles" }, "venue_name": "McDonald's" } ``` -------------------------------- ### Venue Search Progress Endpoint Request (Python, cURL, JavaScript) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenuessearch.md Examples of how to request data from the Venue Search Progress endpoint using Python with the 'requests' library, cURL, and JavaScript's Fetch API. These examples demonstrate setting query parameters like 'job_id', 'collection_id', and 'format' to retrieve specific progress information. ```python import requests url = "https://besttime.app/api/v1/venues/progress" params = { 'job_id': '0a693bb3-7bd6-4d43-9495-a2773f1c9e29', 'collection_id': 'col_ffbebb4003974979b75a14844d60e9c5', 'format': 'raw' } response = requests.request("GET", url, params=params) print(response.json()) ``` ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/venues/progress? job_id=0a693bb3-7bd6-4d43-9495-a2773f1c9e29&collection_id=col_ffbebb4003974979b75a14844d60e9c5& format=raw' ``` ```javascript const params = new URLSearchParams({ 'job_id': '0a693bb3-7bd6-4d43-9495-a2773f1c9e29', 'collection_id': 'col_ffbebb4003974979b75a14844d60e9c5', 'format': 'raw' }); fetch(`https://besttime.app/api/v1/venues/progress?${params}`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### Get Foot-Traffic Forecast (cURL) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_forecastendpoints.md This example demonstrates how to make a POST request to the BestTime.app API using cURL to get a venue's foot-traffic forecast. It includes the necessary parameters like private API key, venue name, and venue address. ```shell # cURL curl --location --request POST 'https://besttime.app/api/v1/forecasts? api_key_private=pri_50990bf1f8828f6abbf6152013113c6b& venue_name=McDonalds& venue_address=Ocean%20Ave%2C%20San%20Francisco' ``` -------------------------------- ### Deploy Slate to Cloudflare Pages Source: https://github.com/besttime-app/slate/blob/master/README.md Instructions for deploying Slate documentation to Cloudflare Pages. This involves zipping the contents of the 'build' folder and uploading it via the Cloudflare Pages interface. ```bash Zip the files inside 'build' folder and deploy to cloudflare using Pages > Upload zip ``` -------------------------------- ### Query Peak Hours - cURL Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointspeakhours.md Execute a cURL command to query peak hours from the BestTime App API. This example shows the equivalent GET request as the Python snippet, suitable for command-line use. ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/forecasts/peaks?api_key_public=pub_e11661721b084d36b8f469a2c012e754&venue_id=ven_51387131543761435650505241346a394a6432395362654a496843&\nday_step=0&\nhour_step=0' ``` -------------------------------- ### Build Slate with Docker Source: https://github.com/besttime-app/slate/blob/master/README.md Command to build Slate documentation using Docker. It mounts local directories for build and source files into the container and executes the build process. ```bash docker run --rm --name slate -v $(pwd)/build:/srv/slate/build -v $(pwd)/source:/srv/slate/source slatedocs/slate build ``` -------------------------------- ### Query Peak Hours - JavaScript Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointspeakhours.md Fetch peak hours using JavaScript's fetch API. This example demonstrates making a GET request to the BestTime App API, including parameters for venue and time. ```javascript const params = new URLSearchParams({ 'api_key_public': 'pub_e11661721b084d36b8f469a2c012e754', 'venue_id': 'ven_51387131543761435650505241346a394a6432395362654a496843', 'day_step': 0, 'hour_step': 0 }); fetch(`https://besttime.app/api/v1/forecasts/peaks?${params}`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### Serve Slate Locally with Docker Source: https://github.com/besttime-app/slate/blob/master/README.md Command to run a local Slate server using Docker. It maps port 4567 and mounts the source directory, allowing you to view the documentation at http://localhost:4567. ```bash docker run --rm --name slate -p 4567:4567 -v $(pwd)/source:/srv/slate/source slatedocs/slate serve ``` -------------------------------- ### Query Day Forecast (cURL) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsday.md Executes a cURL command to query a specific day's forecast data from the Besttime App API. This is a command-line equivalent to the Python example, using GET request with query parameters. ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/forecasts/day?api_key_public=pub_e11661721b084d36b8f469a2c012e754&venue_id=ven_51387131543761435650505241346a394a6432395362654a496843& day_int=3' ``` -------------------------------- ### Clone Slate Repository Source: https://github.com/besttime-app/slate/blob/master/README.md This command demonstrates how to clone your forked Slate repository to your local machine. Replace 'YOURUSERNAME' with your actual GitHub username. This is the first step in setting up Slate locally. ```shell git clone https://github.com/YOURUSERNAME/slate.git ``` -------------------------------- ### Query Raw Hour Data using cURL Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointshourraw.md This example shows how to query raw hourly data from the Besttime App API using a cURL command. It includes the necessary parameters directly in the URL for a GET request. ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/forecasts/hour/raw?api_key_public=pub_e11661721b084d36b8f469a2c012e754&venue_id=ven_51387131543761435650505241346a394a6432395362654a496843&day_int=3&hour=16' ``` -------------------------------- ### Filter Venues via cURL Request Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenuesfilter.md This cURL command demonstrates how to filter venues by making a GET request to the BestTime API. It includes parameters for busyness, location, venue types, and time, mirroring the functionality of the Python example. ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/venues/filter?api_key_private=pri_50990bf1f8828f6abbf6152013113c6b&busy_min=50&busy_max=100&hour_min=18&hour_max=23&hour_conf=any&types=BAR,CAFE,RESTAURANT&lat=51.5121172&lng=-0.126173&radius=2000&order_by=day_rank_max%2Creviews&order=asc%2Cdesc&foot_traffic=both&limit=20&page=0' ``` -------------------------------- ### Query Week Overview with JavaScript Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsweekoverview.md This snippet demonstrates fetching the week overview using JavaScript's `fetch` API. It constructs the query parameters and sends a GET request to the BestTime App API, logging the response to the console. ```javascript const params = new URLSearchParams({ 'api_key_public': 'pub_e11661721b084d36b8f469a2c012e754', 'venue_id': 'ven_51387131543761435650505241346a394a6432395362654a496843' }); fetch(`https://besttime.app/api/v1/forecasts/weekoverview?${params}`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### Query Peak Hours - Python Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointspeakhours.md Retrieve peak hours for a venue using Python's requests library. This example demonstrates how to make a GET request to the 'forecasts/peaks' endpoint with required parameters like API key and venue ID. ```python import requests url = "https://besttime.app/api/v1/forecasts/peaks" params = { 'api_key_public': 'pub_e11661721b084d36b8f469a2c012e754', 'venue_id': 'ven_51387131543761435650505241346a394a6432395362654a496843', 'day_step': 0, 'hour_step': 0 } response = requests.request("GET", url, params=params) print(response.json()) ``` -------------------------------- ### Example JSON Response for Query Day Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsday.md Illustrates the structure of a successful JSON response from the 'query day' endpoint. Includes analysis of busy hours, day information, hourly breakdown, peak hours, quiet hours, and surge hours. ```json { "analysis": { "busy_hours": [ 9, 10, 11 ], "day_info": { "day_int": 0, "day_rank_max": 6, "day_rank_mean": 4, "day_text": "Monday", "venue_closed": 4, "venue_open": 4 }, "hour_analysis": [{ "hour": 6, "intensity_nr": -1, "intensity_txt": "Below average" }, { "hour": 7, "intensity_nr": -1, "intensity_txt": "Below average" }, { "hour": 8, "intensity_nr": 0, "intensity_txt": "Average" }, ....Other hours hidden. See below for the full JSON response example... { "hour": 5, "intensity_nr": -1, "intensity_txt": "Below average" } ], "peak_hours": [{ "peak_delta_mean_week": 29, "peak_end": 23, "peak_intensity": 4, "peak_max": 11, "peak_start": 8 }], "quiet_hours": [ 2, 3, 4, 5 ], "surge_hours": { "most_people_come": 8, "most_people_leave": 0 } }, "day_int": 0, "epoch_analysis": 1583400856, "forecast_updated_on": "2020-03-05T09:34:16.836061+00:00", "status": "OK", "venue_id": "ven_51387131543761435650505241346a394a6432395362654a496843", "venue_name": "McDonald's" } ``` -------------------------------- ### Authentication and API Key Management Source: https://github.com/besttime-app/slate/blob/master/combined_documentation.md This section details how to authenticate with the BestTime.app API using API keys. It explains the purpose of private and public keys and provides examples for obtaining and using them. ```APIDOC ## GET /api/v1/keys/{private_api_key} ### Description Retrieves authentication details, including public and private API keys, for a given private API key. This endpoint is used to verify the validity and status of an API key. ### Method GET ### Endpoint `/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122` ### Parameters #### Path Parameters - **private_api_key** (string) - Required - Your 36 character private API key. ### Request Example ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122' ``` ```javascript fetch(`https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` ### Response #### Success Response (200) - **active** (boolean) - Indicates if the API key is active. - **api_key_private** (string) - Your 32 character private API key. - **api_key_public** (string) - Your 32 character public API key. - **status** (string) - The status of the API key (e.g., "OK"). - **valid** (boolean) - Indicates if the API key is valid. #### Response Example ```json { "active": true, "api_key_private": "pri_a00de9e302662c0217a9cf08ab304122", "api_key_public": "pub_e11661721b084d36b8f469a2c012e754", "status": "OK", "valid": true } ``` ``` -------------------------------- ### Query Single Venue - JavaScript Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsvenue.md Provides an example of querying a single venue's information using the BestTime API with JavaScript's fetch API. It makes a GET request to the venue endpoint, passing the public API key as a query parameter, and logs the response data. ```javascript fetch(`https://besttime.app/api/v1/venues/ven_51387131543761435650505241346a394a6432395362654a496843?api_key_public=pub_e11661721b084d36b8f469a2c012e754`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### Query Week Overview with Python Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsweekoverview.md This snippet demonstrates how to fetch the week overview data from the BestTime App API using Python's `requests` library. It requires a public API key and a venue ID to make the GET request and prints the JSON response. ```python import requests url = "https://besttime.app/api/v1/forecasts/weekoverview" params = { 'api_key_public': 'pub_e11661721b084d36b8f469a2c012e754', 'venue_id': 'ven_51387131543761435650505241346a394a6432395362654a496843', } response = requests.request("GET", url, params=params) print(response.json()) ``` -------------------------------- ### Get Collection Venues Source: https://github.com/besttime-app/slate/blob/master/combined_documentation.md Retrieves a list of all venue IDs within a specified collection. Requires the collection ID and private API key. The request method is GET. ```python import requests url = "https://besttime.app/api/v1/collection/col_51387131543761435650505241346a39" params = { 'api_key_private': 'pri_s43661721b084d36b8f469a2c012e754', } response = requests.request("GET", url, params=params) print(response.json()) ``` ```shell # cURL curl --location --request GET 'https://besttime.app/api/v1/collection/col_51387131543761435650505241346a39?api_key_private=pri_s43661721b084d36b8f469a2c012e754' ``` ```javascript const params = new URLSearchParams({ 'api_key_private': 'pri_s43661721b084d36b8f469a2c012e754', }); fetch(`https://besttime.app/api/v1/collection/col_51387131543761435650505241346a39?${params}`, { method: 'GET' }).then(function(data) { console.log(data); }); ``` -------------------------------- ### API Key Authentication Source: https://github.com/besttime-app/slate/blob/master/source/includes/_apireference.md This section details how to authenticate with the BestTime.app API using API keys. It explains the difference between private and public keys and how to obtain them. ```APIDOC ## GET /api/v1/keys/{api_key} ### Description Retrieves information about an API key, including its private and public components and its validity status. ### Method GET ### Endpoint `/api/v1/keys/{api_key}` ### Parameters #### Path Parameters - **api_key** (string) - Required - Your private API key to authenticate the request. ### Request Example ```shell curl --location --request GET 'https://besttime.app/api/v1/keys/pri_a00de9e302662c0217a9cf08ab304122' ``` ### Response #### Success Response (200) - **active** (boolean) - Indicates if the API key is currently active. - **api_key_private** (string) - The private API key. - **api_key_public** (string) - The public API key. - **status** (string) - The status of the API key (e.g., "OK"). - **valid** (boolean) - Indicates if the API key is valid. #### Response Example ```json { "active": true, "api_key_private": "pri_a00de9e302662c0217a9cf08ab304122", "api_key_public": "pub_e11661721b084d36b8f469a2c012e754", "status": "OK", "valid": true } ``` ``` -------------------------------- ### Query Hour Endpoint Example Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointshour.md Illustrates how to query the BestTime API for hourly forecast data. This involves specifying venue details and receiving an analysis of venue busyness. ```http POST https://besttime.app/api/v1/forecasts/hour ``` -------------------------------- ### Get Hourly Forecast (cURL) Source: https://github.com/besttime-app/slate/blob/master/combined_documentation.md Fetches hourly forecast data for a specific venue and day using a GET request. Requires API key, venue ID, day integer, and hour integer. ```shell curl --location --request GET 'https://besttime.app/api/v1/forecasts/hour?api_key_public=pub_e11661721b084d36b8f469a2c012e754&venue_id=ven_51387131543761435650505241346a394a6432395362654a496843&\n day_int=3&\n hour=23' ``` -------------------------------- ### Get Live Foot-Traffic Data (Python) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_forecastliveendpoints.md Fetches live foot-traffic data for a specified venue using the venue name and address. Requires the 'requests' library. Input is a POST request with parameters including API key, venue name, and address. Output is a JSON response containing venue forecast and live busyness information. ```python import requests url = "https://besttime.app/api/v1/forecasts/live" params = { 'api_key_private': 'pri_50990bf1f8828f6abbf6152013113c6b', 'venue_name': 'McDonalds', 'venue_address': 'Ocean Ave, San Francisco' } response = requests.request("POST", url, params=params) print(response.json()) ``` -------------------------------- ### Subscription Plans Source: https://github.com/besttime-app/slate/blob/master/source/includes/_apireference.md Overview of the two subscription plan types offered by BestTime: Metered and Packaged plans. ```APIDOC ## Subscription Plans ### Description BestTime offers two primary subscription models: Metered and Packaged plans. ### Metered Plans - Charges are based on credit usage, billed at the end of a billing cycle (typically monthly). - The basic plan is the lowest-priced option and includes all functionalities. ### Packaged Plans - Offer a fixed monthly fee with unlimited calls for forecast, live, and query API endpoints. - These plans have limitations on the number of new venues and venue search calls per calendar month. ``` -------------------------------- ### Query Quiet Hours (GET Request) Source: https://github.com/besttime-app/slate/blob/master/source/includes/_queryendpointsquiethours.md Demonstrates how to query quiet hours for a venue using a GET request. Requires venue_id and api_key_public. Optional parameters like day_int, day_step, and hour_step can be used to specify the day and time. ```HTTP GET https://besttime.app/api/v1/forecasts/quiet?venue_id=YOUR_VENUE_ID&api_key_public=YOUR_API_KEY ``` -------------------------------- ### Query Quiet Hours GET Request Source: https://github.com/besttime-app/slate/blob/master/combined_documentation.md This snippet demonstrates how to construct a GET request to the 'query quiet hours' endpoint. It includes the base URL, required parameters like venue_id and api_key_public, and optional parameters such as day_int or day_step/hour_step for time filtering. ```HTTP GET https://besttime.app/api/v1/forecasts/quiet?venue_id=YOUR_VENUE_ID&api_key_public=YOUR_API_KEY Optional parameters: ?day_int=0 (for Monday) ?day_step=1 (for tomorrow) ?hour_step=-2 (for 2 hours ago) ```