### GET Request Example Source: https://www.tines.com/docs/actions/types/http-request This example demonstrates how to send a simple GET request with query parameters. ```APIDOC ## GET /get ### Description Sends a simple GET request to the specified URL with query parameters. ### Method GET ### Endpoint https://postman-echo.com/get?foo1=bar1&foo2=bar2 ### Parameters #### Query Parameters - **foo1** (string) - Required - Parameter for the request. - **foo2** (string) - Required - Parameter for the request. ### Request Example ```json { "url": "https://postman-echo.com/get?foo1=bar1&foo2=bar2'", "method": "get" } ``` ### Response #### Success Response (200) - **args** (object) - Contains the query parameters sent. - **headers** (object) - Contains the headers of the request. - **url** (string) - The URL that was requested. #### Response Example ```json { "args": { "foo1": "bar1", "foo2": "bar2" }, "headers": { "x-forwarded-proto": "https", "x-forwarded-host": "postman-echo.com", "host": "postman-echo.com", "content-length": "0", "x-amzn-trace-id": "Root=1-655f7e7a-3a0b5e2b3f7f7f7f7f7f7f7f" }, "url": "https://postman-echo.com/get?foo1=bar1&foo2=bar2'" } ``` ``` -------------------------------- ### Python Script Requirements Example Source: https://www.tines.com/docs/actions/tools/run-script This example shows the format for specifying Python script dependencies in a `requirements.txt` file. Each dependency should be on a new line. This is used by the Run Script action to install necessary packages before execution. ```text numpy==1.25 http==0.02 ``` -------------------------------- ### Implode Mode Configuration Example Source: https://www.tines.com/docs/actions/types/event-transformation/implode This example demonstrates how to configure Implode mode to reassemble an array of URLs from a previous action. It specifies the mode, the path to the items to collect, a GUID for related events, and the expected size of the array. ```json { "mode": "implode", "item_path": "<>", "guid_path": "<>", "size_path": "<>" } ``` -------------------------------- ### Run Tines Tunnel Container and Expose Metrics Source: https://www.tines.com/docs/admin/tunnel/health-check-metrics This example shows the `docker run` command to start a Tines tunnel container, exposing the metrics endpoint to the host. It includes setting necessary environment variables and port mappings, allowing external access to metrics. ```shell docker run \ -d \ --name tines-tunnel \ --env TUNNEL_METRICS_PORT=9000 \ --env TINES_TUNNEL_SECRET="YOUR_TUNNEL_SECRET" \ -p 0.0.0.0:9000:9000 \ tines/tines-tunnel:latest curl http://0.0.0.0:9000/metrics ``` -------------------------------- ### Example JIT Configuration for Tenant Owners Source: https://www.tines.com/docs/admin/user-administration/scim This example demonstrates a Just-in-Time (JIT) configuration to ensure a specific Identity Provider group is recognized by Tines for granting tenant owner status. This is useful before setting up SCIM to avoid losing owner privileges. ```json { "group_attribute_name": "Group", "tenant_owners_groups": ["Admins"], "mappings": [] } ``` -------------------------------- ### Get Current Date/Time (Tines) Source: https://www.tines.com/docs/actions/formulas/examples Provides an example of getting the current date and time formatted as 'yyyymmdd' using the DATE function in Tines. It utilizes the '%Y%m%d' format specifier. ```Tines DATE("now", "%Y%m%d") ``` -------------------------------- ### Get Current Story Run GUID - Tines Formula Source: https://www.tines.com/docs/formulas/functions/story-run-guid The STORY_RUN_GUID() function is a Tines formula that returns the unique identifier (GUID) of the story run currently in execution. This function requires no arguments and is useful for logging or referencing specific story executions. The output is a string representing the GUID. ```tines-formula STORY_RUN_GUID() ``` -------------------------------- ### Python AWS SDK (boto3) Example for Listing S3 Buckets Source: https://www.tines.com/docs/actions/templates/templates/frequently-used-templates/run-python-script This Python script demonstrates how to use the AWS SDK (boto3) within the Run Script action to interact with AWS services. It shows how to retrieve credentials from the `input` object (provided by Tines after setting up an AWS credential) and use them to instantiate an S3 client and list buckets. ```python import boto3 def main(input): # Return early if credential fetch failed if not input.get('AwsCredentials', {}).get('Success', False): return input creds = input["AwsCredentials"] # Use the assumed credentials to access S3 in the other account s3 = boto3.client( 's3', aws_access_key_id=creds['AccessKeyId'], aws_secret_access_key=creds['SecretAccessKey'], aws_session_token=creds['SessionToken'], ) # List buckets buckets = s3.list_buckets() return {'buckets': [bucket['Name'] for bucket in buckets['Buckets']]} ``` -------------------------------- ### Building a Simple Dynamic Job Scheduler with Sidekiq Source: https://www.tines.com/docs/story This snippet demonstrates how to build a dynamic job scheduler using Sidekiq, a popular background job processing framework for Ruby. It covers setting up the scheduler and defining job execution. ```ruby require 'sidekiq' class DynamicJobScheduler include Sidekiq::Worker def perform(job_name, *args) puts "Running job: #{job_name} with args: #{args.inspect}" # Logic to execute the dynamic job based on job_name and args case job_name when 'send_email' send_email(*args) when 'process_data' process_data(*args) else puts "Unknown job: #{job_name}" end end def send_email(to, subject, body) # Email sending logic puts "Sending email to #{to} with subject '#{subject}'" end def process_data(data) # Data processing logic puts "Processing data: #{data.inspect}" end end # Example of enqueuing a job: # DynamicJobScheduler.perform_async('send_email', 'test@example.com', 'Hello', 'This is a test email.') # DynamicJobScheduler.perform_async('process_data', { key: 'value' }) ``` -------------------------------- ### Basic Authentication and Custom Headers Source: https://www.tines.com/docs/actions/types/http-request Demonstrates how to configure Basic Authentication for a request, securely accessing credentials using the `CREDENTIAL` formula. It also shows how to include custom headers. ```json { "url": "https://postman-echo.com/basic-auth", "method": "get", "headers": { "X-Tines-Request": "123456" }, "basic_auth": "postman:<>" } ``` -------------------------------- ### REGEX_REPLACE Function Syntax and Examples Source: https://www.tines.com/docs/formulas/functions/regex-replace Demonstrates the syntax and practical application of the REGEX_REPLACE function. It takes the input text, a regular expression to match, and the replacement string as arguments. The example shows replacing words starting with 'h' in a message. ```Tines Formula REGEX_REPLACE(my_action.message, "h\w+", "goodbye") ``` -------------------------------- ### List IAM Users Source: https://www.tines.com/docs/credentials/aws Retrieves a list of IAM users associated with your AWS account. This endpoint uses a GET request with specific payload parameters. ```APIDOC ## GET /iam ### Description Retrieves a list of IAM users associated with your AWS account. ### Method GET ### Endpoint https://iam.amazonaws.com ### Parameters #### Query Parameters - **Action** (string) - Required - The action to perform, which is 'ListUsers'. - **Version** (string) - Required - The API version, '2010-05-08'. #### Headers - **Authorization** (string) - Required - AWS IAM credentials for authentication. ### Request Example ```json { "url": "https://iam.amazonaws.com", "content_type": "form", "method": "get", "payload": { "Action": "ListUsers", "Version": "2010-05-08" }, "headers": { "Authorization": "<>" } } ``` ### Response #### Success Response (200) - **ListUsersResult** (object) - Contains the list of users. - **Users** (array) - A list of IAM user objects. - **UserName** (string) - The name of the IAM user. - **UserId** (string) - The unique ID of the IAM user. - **Arn** (string) - The Amazon Resource Name (ARN) of the IAM user. - **CreateDate** (string) - The date and time when the IAM user was created. - **Path** (string) - The path to the IAM user. #### Response Example ```json { "ListUsersResult": { "Users": [ { "UserName": "example-user", "UserId": "AIDAXXXXXXXXXXXXXXXXX", "Arn": "arn:aws:iam::123456789012:user/example-user", "CreateDate": "2023-01-01T12:00:00Z", "Path": "/" } ] } } ``` ``` -------------------------------- ### Example Configuration for Automatic Mode Source: https://www.tines.com/docs/actions/types/event-transformation/automatic Demonstrates the configuration options for the 'automatic' mode, including input data and the plain English guidance for transformation. This is used to trigger AI-driven script generation. ```json { "mode": "automatic", "input": "<>", "guidance": "Name of the team with the highest count" } ``` -------------------------------- ### Start Tines Tunnel Service on AWS ECS Source: https://www.tines.com/docs/admin/tunnel/installing-the-tines-tunnel-on-aws-fargate This snippet starts the Tines Tunnel service on AWS ECS. It requires you to provide the subnet IDs for your VPC. This command initiates the deployment of the ECS service using the previously defined task definition and cluster. Ensure your VPC and subnets are correctly configured. ```bash # Replace these with the IDs of two subnets from your VPC: SUBNET_IDS=subnet-606e7706,subnet-bd5bb2f6 ``` -------------------------------- ### GET /api/v1/actions (with Pagination) Source: https://www.tines.com/docs/actions/types/http-request This endpoint retrieves a list of actions and supports pagination. The example demonstrates how to dynamically set the 'page' query parameter using previous response data to fetch subsequent pages. ```APIDOC ## GET /api/v1/actions ### Description Retrieves a list of actions, supporting pagination to fetch data across multiple pages. ### Method GET ### Endpoint `https://<>/api/v1/actions` ### Query Parameters - **page** (integer) - Optional - The page number to retrieve. This value is dynamically set based on the `next_page_number` from the previous response. ### Request Body This endpoint does not have a request body. ### Request Example ```json { "url": "https://<>/api/v1/actions", "method": "get", "headers": { "Authorization": "Bearer <>" }, "content_type": "application_json", "payload": { "page": "<>" }, "pagination_options": { "enabled": true, "has_more": "<>", "output_as_single_event": false } } ``` ### Response #### Success Response (200) - **body** (object) - The response body containing a list of actions and meta information for pagination. - **meta** (object) - Meta information for pagination. - **next_page_number** (integer) - The page number for the next set of results. This will be null when there are no more pages. #### Response Example ```json { "data": [ { "id": 1, "name": "Example Action 1" }, { "id": 2, "name": "Example Action 2" } ], "meta": { "current_page": 1, "next_page_number": 2, "total_pages": 5 } } ``` ### Notes - `PAGINATE.previous_response` is `null` on the first request. - The `has_more` condition is ignored on the first request. - Ensure parameters change on each request to avoid fetching the same page repeatedly. - `output_as_single_event` can be set to `true` to output all pages as a single event. ```