### Offset-based Pagination Example Source: https://support.google.com/appsheet/answer/10106762 This example demonstrates how to configure offset-based pagination for a GET ALL operation in an OpenAPI Spec for Apigee connections. It includes the necessary parameters and the `x-pagination` extension. ```APIDOC ## GET /users ### Description Retrieves a list of users with support for offset-based pagination. ### Method GET ### Endpoint /users ### Query Parameters - **limit** (integer) - Optional - The maximum number of items to return. - **offset** (integer) - Optional - The number of items to skip from the beginning. ### Response #### Success Response (200) - **Array of person** (array) - An array of person objects. ### Request Example ``` api/users?limit=30&offset=0 ``` ### OpenAPI Spec Snippet (YAML) ```yaml /users: get: tags: - person parameters: - name: limit in: query required: false schema: type: integer format: int64 - name: offset in: query required: false schema: type: integer format: int64 responses: '200': description: Array of all person in the system with filter and pagination content: application/json: schema: type: array items: $ref: '#/components/schemas/Person' x-pagination: type: offset limitParam: limit defaultLimit: 30 offsetParam: offset defaultOffset: 0 ``` ``` -------------------------------- ### Cursor-based Pagination Example Source: https://support.google.com/appsheet/answer/10106762 This example illustrates how to set up cursor-based pagination for a GET ALL operation using an OpenAPI Spec for Apigee connections. It specifies the cursor parameter and other pagination directives. ```APIDOC ## GET /users ### Description Retrieves a list of users with support for cursor-based pagination. ### Method GET ### Endpoint /users ### Query Parameters - **page_size** (integer) - Optional - The number of items to return per page. - **page_token** (integer) - Optional - The token representing the current page. ### Response #### Success Response (200) - **Array of person** (array) - An array of person objects. ### Request Example ``` api/users?page_size=30&page_token=GIYDAOBNGEYS2MBWKQYDAO ``` ### OpenAPI Spec Snippet (YAML) ```yaml /users: get: tags: - person parameters: - name: page_size in: query required: false schema: type: integer format: int64 - name: page_token in: query required: false schema: type: integer format: int64 responses: '200': description: Array of all person in the system with filter and pagination content: application/json: schema: type: array items: $ref: '#/components/schemas/Person' x-pagination: type: cursor limitParam: page_size defaulLimit: 30 cursorParam: page_token ``` ``` -------------------------------- ### Example Access Token Response Source: https://support.google.com/appsheet/answer/10106762 This is an example of a successful response when verifying client credentials, containing the `access_token` required for API calls. ```json { ... "token_type" : "BearerToken", "client_id" : "xNnREu1DNGfiwzQZ5HUN8IAUwZSW1GZW", "access_token" : "GTPY9VUHCqKVMRB0cHxnmAp0RXc0", "refresh_token_expires_in" : "30000", //--in seconds ... } ``` -------------------------------- ### Cursor-based Pagination URL Example Source: https://support.google.com/appsheet/answer/10106762 This URL shows an example of a request to an API endpoint configured with cursor-based pagination, including parameters for page size and a cursor token. ```url api/users?page_size=30&page_token=GIYDAOBNGEYS2MBWKQYDAO ``` -------------------------------- ### AppSheet API Selector examples Source: https://support.google.com/appsheet/answer/10105770?hl=en&ref_topic=10105767 Provides various examples of 'Selector' expressions for filtering, selecting, ordering, and limiting rows in AppSheet API requests. ```text "Selector": "Filter(People, true)" ``` ```text "Selector": "Filter(People, [Age] >= 21)" ``` ```text "Selector": "Select(People[_ComputedKey], And([Age] >= 21, [State] = \"CA\"), true)" ``` ```text "Selector": "OrderBy(Filter(People, [Age] >= 21), [LastName], true)" ``` ```text "Selector": "Top(OrderBy(Filter(People, [Age] >= 21), [LastName], true), 10)" ``` ```text "Selector": "Top(OrderBy(Select(People[_ComputedKey], And([Age] >= 21, [Date Hired] > \"01/01/2016\"), true), [LastName], false), 100)" ``` -------------------------------- ### AppSheet FLOOR() function examples Source: https://support.google.com/appsheet/answer/10106537 Use FLOOR() to round down to the nearest integer. Examples show positive, negative, and integer inputs. ```AppSheet FLOOR(3.14) ``` ```AppSheet FLOOR(-3.14) ``` ```AppSheet FLOOR(5) ``` -------------------------------- ### Dynamic Update Mode Expression Example Source: https://support.google.com/appsheet/answer/10106345?hl=en&ref_topic=10102046 Use this expression to dynamically set update modes based on user email. It allows a specific user read-only access, while others get updates only. ```AppSheet Expression SWITCH(USEREMAIL(), "user1@mydomain.com", "UPDATES_ONLY", "READ_ONLY") ``` -------------------------------- ### Manually Re-seed Oracle IDENTITY Column Source: https://support.google.com/appsheet/answer/10106766 If you have an existing Oracle IDENTITY column with the default initial seed of 1, you can manually re-seed it to a higher value using an ALTER TABLE statement. This example shows how to set the starting value to 100000. ```sql ALTER TABLE _tablename_ MODIFY (_columnName_ GENERATED START WITH 100000) ``` -------------------------------- ### Get Year Component with YEAR() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use YEAR() to get the year from a Date value. ```AppSheet YEAR() ``` -------------------------------- ### Offset-based Pagination URL Example Source: https://support.google.com/appsheet/answer/10106762 This URL demonstrates how to make a request to an API endpoint configured with offset-based pagination, specifying a limit and offset. ```url api/users?limit=30&offset=0 ``` -------------------------------- ### Navigate to app with LINKTOAPP() Source: https://support.google.com/appsheet/answer/10106757?hl=en&ref_topic=10102630 Use LINKTOAPP() to navigate to a specified app and display its default starting view. Ensure the app ID is correct. ```appsheet LINKTOAPP("MyApp-123") ``` -------------------------------- ### Get Day of Month with DAY() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use DAY() to get the day of the month from a Date value. ```AppSheet DAY() ``` -------------------------------- ### AppSheet CEILING() function examples Source: https://support.google.com/appsheet/answer/10104440 Demonstrates the usage of the CEILING() function with positive, negative, and integer values. Ensure the input is a numeric value. ```AppSheet CEILING(3.14) ``` ```AppSheet CEILING(-3.14) ``` ```AppSheet CEILING(5) ``` -------------------------------- ### Get Month Number with MONTH() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use MONTH() to get the month number (1-12) from a Date value. ```AppSheet MONTH() ``` -------------------------------- ### Get Total Seconds from Duration with TOTALSECONDS() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use TOTALSECONDS() to get the total number of seconds in a Duration value. ```AppSheet TOTALSECONDS() ``` -------------------------------- ### POWER() Function Examples Source: https://support.google.com/appsheet/answer/10106551 Demonstrates various uses of the POWER() function with positive, negative, and zero exponents. Ensure inputs are numeric types. ```AppSheet POWER(-2.23, 3) ``` ```AppSheet POWER(-2.23, 2) ``` ```AppSheet POWER(-2.23, 1) ``` ```AppSheet POWER(-2.23, 0) ``` ```AppSheet POWER(-2.23, -1) ``` ```AppSheet POWER(-2.23, -2) ``` ```AppSheet POWER(-2.23, -3) ``` -------------------------------- ### Get Total Minutes from Duration with TOTALMINUTES() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use TOTALMINUTES() to get the total number of minutes in a Duration value. ```AppSheet TOTALMINUTES() ``` -------------------------------- ### Get Total Hours from Duration with TOTALHOURS() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use TOTALHOURS() to get the total number of hours in a Duration value. ```AppSheet TOTALHOURS() ``` -------------------------------- ### Lookup function example Source: https://support.google.com/appsheet/answer/13036033?hl=en&ref_topic=11981018 Provides examples of the LOOKUP() function to retrieve a value from a column in a corresponding row based on a matching email address. Ensure the 'Email' column in the 'Lookup Table' matches the 'Chosen Email'. ```AppSheet LOOKUP([Chosen Email], "Lookup Table", "Email", "Name") LOOKUP([Chosen Email], "Lookup Table", "Email", "Color") ``` -------------------------------- ### Access API with Bearer Token using curl Source: https://support.google.com/appsheet/answer/10106762 After obtaining an access token, use this `curl` command to call your API. Ensure you replace `{org-name}`, `{tablename}`, and `{access-token}` with your specific values. ```bash curl https://{org-name}-test.apigee.net/tablename \ -H "Authorization: Bearer {access-token}" ``` -------------------------------- ### Get ISO Week Number with ISOWEEKNUM() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use ISOWEEKNUM() to get the ISO week number from a Date or DateTime value. ```AppSheet ISOWEEKNUM() ``` -------------------------------- ### Get Current Date with TODAY() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use TODAY() to get the current Date on the user's device. This is equivalent to DATE(NOW()). ```AppSheet TODAY() ``` -------------------------------- ### Configure SQL Server non-default instance Source: https://support.google.com/appsheet/answer/10106599 To specify a non-default instance name for SQL Server, append the instance name to the server name, preceded by a backslash. ```text mycomputer.test.xxx.com\myInstance ``` -------------------------------- ### Get Current Time with TIMENOW() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use TIMENOW() to get the current Time on the user's device. This is equivalent to TIME(NOW()). ```AppSheet TIMENOW() ``` -------------------------------- ### INDEX() Syntax Source: https://support.google.com/appsheet/answer/10107336 The basic syntax for the INDEX() function, specifying the list and the index of the desired item. The first item in the list is indexed as 1. ```AppSheet INDEX(_list_, _which-one_) ``` -------------------------------- ### Get Week Number with WEEKNUM() Source: https://support.google.com/appsheet/answer/10107326?hl=en&ref_topic=10104376 Use WEEKNUM() to get the week number of the year from a Date value. A week begins on Sunday. ```AppSheet WEEKNUM() ``` -------------------------------- ### Alternative MINUTE() Calculation - AppSheet Source: https://support.google.com/appsheet/answer/10107346 This note shows an equivalent calculation for MINUTE() using TEXT(), SPLIT(), INDEX(), and NUMBER() when the input is a Time value. It demonstrates how to manually parse the time components. ```appsscript (NUMBER(INDEX(SPLIT(TEXT(...), ":"), 2)) + 0) ```