### Dynamic Documentation Query Example Source: https://manual.bubble.io/core-resources/api/the-bubble-api/the-data-api/data-api-endpoints An example of how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter. ```http GET https://manual.bubble.io/core-resources/api/the-bubble-api/the-data-api/data-api-endpoints.md?ask= ``` -------------------------------- ### Fetching Data with Constraints Source: https://manual.bubble.io/help-guides/integrations/api/the-bubble-api/the-data-api/data-api-requests This example demonstrates how to fetch data from the Data API using the GET method and applying multiple constraints to filter the results. It shows how to search for rental units based on their name and number. ```APIDOC ## GET /api/1.1/obj/rentalunit ### Description Fetches rental units based on specified constraints. ### Method GET ### Endpoint /api/1.1/obj/rentalunit ### Parameters #### Query Parameters - **constraints** (string) - Required - A JSON array of constraint objects to filter the results. ### Request Example ```json { "constraints": [ { "key": "unitname", "constraint_type": "text contains", "value": "Unit" }, { "key": "unitnumber", "constraint_type": "greater than", "value": "3" } ] } ``` ### Response #### Success Response (200) - **response** (object) - Contains the search results, cursor, count, and remaining records. - **results** (array) - An array of matching records. - **cursor** (number) - The current cursor position. - **count** (number) - The number of results returned in this request. - **remaining** (number) - The number of records remaining to be fetched. #### Response Example ```json { "response": { "cursor": 0, "results": [ { "Modified Date": "2022-12-30T11:03:11.097Z", "Created Date": "2022-12-30T11:03:11.097Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 4", "Unit number": 4, "_id": "1672398191097x872601726695236800" }, { "Modified Date": "2022-12-30T11:03:11.098Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 5", "Unit number": 5, "_id": "1672398191098x642899010515676700" }, { "Modified Date": "2022-12-30T11:03:11.099Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 6", "Unit number": 6, "_id": "1672398191098x774874860707789600" } ], "count": 3, "remaining": 0 } } ``` ``` -------------------------------- ### Passing Options as URL Parameters Source: https://manual.bubble.io/core-resources/bubble-made-plugins/sql-database-connector Demonstrates how to pass library options as query string parameters in the connection URL. ```text protocol://user:password@host:port/database?param1=value1¶m2=value2 ... ``` ```text {user, password, host, port, database, ...param1, param2} ``` -------------------------------- ### API Request Example Source: https://manual.bubble.io/help-guides/integrations/api/api-glossary This example shows how to perform an HTTP GET request to a Bubble API endpoint with an 'ask' query parameter to dynamically query documentation. ```http GET https://manual.bubble.io/help-guides/integrations/api/api-glossary.md?ask= ``` -------------------------------- ### Example Data API GET Response Source: https://manual.bubble.io/help-guides/integrations/api/the-bubble-api/the-data-api/data-api-requests This is a sample JSON response from the Bubble Data API after a successful GET request with specified constraints. It includes the results array, cursor, count, and remaining records. ```json { "response": { "cursor": 0, "results": [ { "Modified Date": "2022-12-30T11:03:11.097Z", "Created Date": "2022-12-30T11:03:11.097Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 4", "Unit number": 4, "_id": "1672398191097x872601726695236800" }, { "Modified Date": "2022-12-30T11:03:11.098Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 5", "Unit number": 5, "_id": "1672398191098x642899010515676700" }, { "Modified Date": "2022-12-30T11:03:11.099Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 6", "Unit number": 6, "_id": "1672398191098x774874860707789600" } ], "count": 3, "remaining": 0 } } ``` -------------------------------- ### Implementing Pagination Source: https://manual.bubble.io/help-guides/integrations/api/the-bubble-api/the-data-api/data-api-requests This example shows how to use the 'cursor' and 'limit' parameters to implement pagination for fetching data. This is useful for handling large datasets by retrieving them in smaller, manageable chunks. ```APIDOC ## GET /api/1.1/obj/rentalunit ### Description Fetches a specific range of rental units using pagination parameters. ### Method GET ### Endpoint /api/1.1/obj/rentalunit ### Parameters #### Query Parameters - **cursor** (string) - Optional - The starting point for fetching records (e.g., the 'remaining' value from a previous response). - **limit** (string) - Optional - The maximum number of results to return per page. Defaults to 100. ### Request Example To get results from the 2nd record to the 5th (inclusive), you would set cursor to 2 and limit to 3. ```json { "cursor": "2", "limit": "3" } ``` ### Response #### Success Response (200) - **response** (object) - Contains the search results, cursor, count, and remaining records. - **results** (array) - An array of matching records. - **cursor** (number) - The current cursor position. - **count** (number) - The number of results returned in this request. - **remaining** (number) - The number of records remaining to be fetched, which can be used as the next cursor. #### Response Example ```json { "response": { "cursor": 2, "results": [ { "Modified Date": "2022-12-30T11:03:11.097Z", "Created Date": "2022-12-30T11:03:11.097Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 4", "Unit number": 4, "_id": "1672398191097x872601726695236800" }, { "Modified Date": "2022-12-30T11:03:11.098Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 5", "Unit number": 5, "_id": "1672398191098x642899010515676700" }, { "Modified Date": "2022-12-30T11:03:11.099Z", "Created Date": "2022-12-30T11:03:11.098Z", "Created By": "admin_user_securitybook_test", "Unit name": "Rental unit 6", "Unit number": 6, "_id": "1672398191098x774874860707789600" } ], "count": 3, "remaining": 0 } } ``` ``` -------------------------------- ### Workflow Event-Action Sequence Example Source: https://manual.bubble.io/core-resources/bubble-workflows/bubble-actions Illustrates the basic structure of a workflow, starting with an event that triggers one or more actions. ```text Event → Action(s) Button click → Create a new database thing ``` -------------------------------- ### Retrieve Record by ID (Success Response) Source: https://manual.bubble.io/core-resources/api/the-bubble-api/the-data-api/data-api-requests Example of a successful GET request response for retrieving a single record by its unique ID. Includes record details. ```json { "response": { "_id": "1671702337369x488321592367327900", "Created By": "example@example.com", "Created Date": "2022-12-22T09:45:37.369Z", "Modified Date": "2022-12-22T09:45:37.417Z", "Unit name": "Unit A" } } ``` -------------------------------- ### Example JSON for Creating a User Source: https://manual.bubble.io/help-guides/integrations/api/introduction-to-apis/what-is-a-restful-api This JSON object demonstrates the structure for creating a new user, including name, age, and administrative privileges. ```json { "name": "John Doe", "age": 30, "isAdmin": true, } ``` -------------------------------- ### Key-Value Pair Example for URL Parameters Source: https://manual.bubble.io/help-guides/data/temporary-data This example illustrates the key-value pair structure used in URL parameters, where 'name' and 'age' are keys and 'john' and '56' are their respective values. ```url ?name=john&age=56 ``` -------------------------------- ### Update list length: Plugin API v4 Source: https://manual.bubble.io/account-and-marketplace/building-plugins/updating-to-plugin-api-v4 Example of getting the length of a list using the .length() method in Plugin API v4. Requires prepending 'async' and 'await' if used with other async operations. ```javascript function(properties, context) { let list_length = properties.my_list.length() return { list_length } } ``` -------------------------------- ### Query Documentation with GET Request Source: https://manual.bubble.io/beta-features/about-the-beta-features-section Perform an HTTP GET request to query documentation dynamically by including the 'ask' query parameter with a specific question. The response includes a direct answer and relevant excerpts. ```HTTP GET https://manual.bubble.io/beta-features/about-the-beta-features-section.md?ask= ``` -------------------------------- ### Dynamic Documentation Query Source: https://manual.bubble.io/core-resources/bubble-made-plugins/sql-database-connector Perform an HTTP GET request with an 'ask' query parameter to dynamically query the documentation. ```http GET https://manual.bubble.io/core-resources/bubble-made-plugins/sql-database-connector.md?ask= ```