### Python Client Quickstart Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers Connect to the Sift gRPC API using the official Python client library. This guide covers installation and a basic connection example. ```APIDOC ## Connect to gRPC API with Python Client ### Description This section provides steps to quickly connect to Sift's gRPC API using the official Python client library. ### Steps 1. **Create a Python environment**. 2. **Install the Sift Python package**: ```bash pip install sift-stack-py ``` 3. **Create a `main.py` file** with the following code: ```python # main.py # Import necessary libraries (example assumes you have a client setup) # from sift.client import SiftClient # async def main(): # async with SiftClient(grpc_url="$SIFT_GRPC_BASE_URL", api_key="$SIFT_API_KEY") as client: # # Example usage: Make a gRPC call # # response = await client.some_method(request_data) # # print(response) # pass # if __name__ == "__main__": # import asyncio # asyncio.run(main()) ``` 4. **Run the script**: ```bash python main.py ``` ### Parameters - `$SIFT_API_KEY`: Your Sift API key. See [Create an API key](link_to_api_key_creation). - `$SIFT_GRPC_BASE_URL`: The base URL for gRPC requests. The Python client allows omitting the URL scheme and port number. See [Obtain the base URL for REST/gRPC requests](link_to_base_url_obtaining). ``` -------------------------------- ### Rust Client Quickstart Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers Connect to the Sift gRPC API using the official Rust client library (`sift_rs`). This guide covers project setup and a basic connection example. ```APIDOC ## Connect to gRPC API with Rust Client ### Description This section provides steps to quickly connect to Sift's gRPC API using the official Rust client library (`sift_rs`). ### Steps 1. **Create a Rust project**: ```bash cargo new my_sift_project cd my_sift_project ``` 2. **Add `sift_rs` and `tokio` to `Cargo.toml`**: ```toml [dependencies] sift_rs = "*" tokio = { version = "1", features = ["full"] } ``` 3. **Copy and paste the following into `my_sift_project/src/main.rs`**: ```rust // main.rs // #[tokio::main] // async fn main() -> Result<(), Box> { // // let mut client = sift_rs::SiftClient::connect( // // "$SIFT_GRPC_BASE_URL", // Add URL scheme, port is optional // // "$SIFT_API_KEY" // // ).await?; // // // Example usage: Make a gRPC call // // let request = sift_rs::SomeRequest { field: "value".to_string() }; // // let response = client.some_method(request).await?; // // println!("{:?}", response); // // Ok(()) // } ``` 4. **Run the project**: ```bash cargo run ``` ### Parameters - `$SIFT_API_KEY`: Your Sift API key. See [Create an API key](link_to_api_key_creation). - `$SIFT_GRPC_BASE_URL`: The base URL for gRPC requests. The Rust client requires the URL scheme and optionally accepts the port number. See [Obtain the base URL for REST/gRPC requests](link_to_base_url_obtaining). ``` -------------------------------- ### List Assets using cURL Source: https://docs.siftstack.com/docs/api/reference/rest/asset-service/asset-service_-list-assets Example of how to list assets using a cURL command. This demonstrates making an HTTP GET request to the asset service endpoint. ```bash curl "https://example.com/api/v1/assets?pageSize=100&filter=asset_id%3D%3D%22some_asset_id%22&orderBy=created_date+desc" ``` -------------------------------- ### List Applicable Views using cURL Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-applicable-views-v2 Example of how to list views applicable to assets or runs using a cURL command. This demonstrates the HTTP GET request and relevant query parameters. ```bash curl -X GET \ 'https://api.sift.com/v2/views:applicable?pageSize=100&assetIds=asset1,asset2&runIds=run1,run2' \ -H 'Authorization: Bearer YOUR_API_TOKEN' ``` -------------------------------- ### List Annotations using cURL Source: https://docs.siftstack.com/docs/api/reference/rest/annotation-service/annotation-service_-list-annotations Example of how to list annotations using cURL, demonstrating the GET request to the /api/v1/annotations endpoint with optional query parameters for filtering and pagination. ```bash curl GET "/api/v1/annotations?pageSize=10&pageToken=string&filter=string&organizationId=string&orderBy=string" ``` -------------------------------- ### Install Sift Go Module Source: https://docs.siftstack.com/docs/ingestion/client-libraries/go Install the Sift Go module inside of a new Go project. This step is necessary to use the Sift client library for data ingestion. ```bash go get github.com/getsift/sift-go ``` -------------------------------- ### Connect to Sift gRPC API with Python Client Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers Quickstart guide to connect to Sift's gRPC API using the official Python client library. This involves installing the package, creating a Python file with connection logic, and running it with authentication credentials and base URL. ```python from sift.client import SiftClient async def main(): async with SiftClient( api_key="$SIFT_API_KEY", base_url="$SIFT_GRPC_BASE_URL", ) as client: # Your gRPC client logic here print("Successfully connected to Sift gRPC API") if __name__ == "__main__": import asyncio asyncio.run(main()) ``` -------------------------------- ### ListViews API - cURL Example Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-views-v2 Example of how to list views using the ListViews API via cURL. It demonstrates making a GET request to the /api/v2/views endpoint. ```curl curl -X GET \ 'https://your-sift-api.com/api/v2/views?pageSize=50&pageToken=abc&filter=name%3D%3D%27my_view%27' \ -H 'Accept: application/json' ``` -------------------------------- ### List Applicable Views using Python Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-applicable-views-v2 Example of how to list views applicable to assets or runs using the Python client library. This demonstrates making an HTTP GET request with specified query parameters. ```python import requests api_token = "YOUR_API_TOKEN" base_url = "https://api.sift.com/v2" params = { "pageSize": 100, "assetIds": ["asset1", "asset2"], "runIds": ["run1", "run2"] } headers = { "Authorization": f"Bearer {api_token}" } response = requests.get(f"{base_url}/views:applicable", params=params, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### List API Keys using cURL Source: https://docs.siftstack.com/docs/api/reference/rest/api-key-service/api-key-service_-list-api-keys-v2 Example of retrieving API keys using the cURL command-line tool. It demonstrates how to make a GET request to the API endpoint. ```bash curl "https://api.sift.com/v2/api-keys?pageSize=50&filter=name%3D%3D%27my-key%27&orderBy=created_date+desc" ``` -------------------------------- ### List Assets using Python Source: https://docs.siftstack.com/docs/api/reference/rest/asset-service/asset-service_-list-assets Example of how to list assets using Python's requests library. This demonstrates making an HTTP GET request to the asset service endpoint with query parameters. ```python import requests api_endpoint = "https://example.com/api/v1/assets" params = { "pageSize": 100, "filter": 'asset_id=="some_asset_id"', "orderBy": "created_date desc" } response = requests.get(api_endpoint, params=params) if response.status_code == 200: assets = response.json() print(assets) elif response.status_code == 400: print("Bad Request:", response.text) else: print(f"Error: {response.status_code}", response.text) ``` -------------------------------- ### ListReportTemplates API Call (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/report-template-service/report-template-service_-list-report-templates Example of how to list report templates using a cURL command. This demonstrates the HTTP GET request to the specified endpoint with potential query parameters. ```bash curl -X GET \ '/api/v1/report-templates?pageSize=10&pageToken=abc&filter=tag_name%3D%22example%22&organizationId=123&orderBy=created_date+desc' \ -H 'Accept: application/json' ``` -------------------------------- ### List API Keys using Python Source: https://docs.siftstack.com/docs/api/reference/rest/api-key-service/api-key-service_-list-api-keys-v2 Example of retrieving API keys using the Python programming language with the 'requests' library. It shows how to construct and send the GET request. ```python import requests API_KEY = "YOUR_API_KEY" response = requests.get( "https://api.sift.com/v2/api-keys", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, params={ "pageSize": 50, "filter": "name==\'my-key\'", "orderBy": "created_date desc" } ) print(response.json()) ``` -------------------------------- ### ListViews API - Python Example Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-views-v2 Example of how to list views using the ListViews API with Python. It shows how to construct the request and handle the response. ```python import requests base_url = "https://your-sift-api.com/api/v2/views" params = { "pageSize": 50, "pageToken": "abc", "filter": "name==\'my_view\'" } response = requests.get(base_url, params=params, headers={'Accept': 'application/json'}) if response.status_code == 200: views = response.json() print(views) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Install sift-stack-py using pip Source: https://docs.siftstack.com/docs/ingestion/client-libraries/python This command installs the necessary Python package for interacting with Sift. Ensure you have pip installed and configured correctly. ```bash pip install sift-stack-py ``` -------------------------------- ### Influx Line Protocol Data Example Source: https://docs.siftstack.com/docs/ingestion/ingestion-via-influx-line-protocol This is an example of Influx Line Protocol data sent to a 'CA' bucket. It demonstrates the format expected for ingestion into Sift. ```text cpu,host=server01,region=us-west usage_user=10,usage_system=20,usage_idle=70 memory,host=server01,region=us-west usage_user=50,usage_system=10,usage_idle=40 ``` -------------------------------- ### List Annotation Logs using Python Source: https://docs.siftstack.com/docs/api/reference/rest/annotation-log-service/annotation-log-service_-list-annotation-logs2 Example of how to list annotation logs using Python. This demonstrates making an HTTP GET request to the specified endpoint using the `requests` library, including common query parameters for filtering and pagination. ```python import requests api_key = "your-api-key" base_url = "https://your-sift-api.com/v1" def list_annotation_logs(annotation_id=None, page_size=50, page_token=None, filter_string=None): params = { "pageSize": page_size } if annotation_id: params["annotationId"] = annotation_id if page_token: params["pageToken"] = page_token if filter_string: params["filter"] = filter_string headers = { "Authorization": f"Bearer {api_key}" } response = requests.get(f"{base_url}/annotation-logs", params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() # Example usage: # try: # logs = list_annotation_logs(annotation_id="some_annotation_id", page_size=10, filter_string="created_by_user_id == 'user123'") # print(logs) # except requests.exceptions.RequestException as e: # print(f"Error: {e}") ``` -------------------------------- ### Initialize Go Module and Fetch Sift SDK Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers Steps to initialize a Go module and fetch the Sift Go SDK. This involves using the `go mod init` command to set up the project and `go get` to download the SDK. Ensure you are in the correct project directory before executing these commands. ```bash go mod init sift_go_project go get github.com/siftstack/sift-go-sdk ``` -------------------------------- ### List Remote Files using Python Source: https://docs.siftstack.com/docs/api/reference/rest/remote-file-service/remote-file-service_-list-remote-files Example of how to list remote files using Python's requests library. This demonstrates making a GET request to the /api/v1/remote-files endpoint with query parameters. Requires the 'requests' library to be installed. ```python import requests response = requests.get( 'https://www.sift.com/api/v1/remote-files', params={'pageSize': 1000}, headers={'Accept': 'application/json'}, ) print(response.status_code) print(response.json()) ``` -------------------------------- ### Import Sift and other Modules in Go Source: https://docs.siftstack.com/docs/ingestion/client-libraries/go Import the necessary modules, including the Sift Go module, for use in the example. These imports provide access to the Sift client and other required functionalities. ```go package main import ( "context" "fmt" "math/rand" "os" "time" "github.com/getsift/sift-go/client" ) ``` -------------------------------- ### List Tags with cURL Source: https://docs.siftstack.com/docs/api/reference/rest/tag-service/tag-service_-list-tags Example of how to list tags using the cURL command-line tool. This demonstrates a basic GET request to the ListTags endpoint. ```bash curl -X GET \"/api/v1/tags\" \"-H \"Content-Type: application/json\"\n ``` -------------------------------- ### Go Client Example for Sift API Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers An example Go program demonstrating how to connect to the Sift gRPC API. It requires environment variables for the API key, gRPC base URL, and port number. The base URL should not include the scheme, and the port number must be explicitly provided. ```go package main import ( "context" "log" "os" "strconv" "github.com/siftstack/sift-go-sdk/pkg/sift" ) func main() { apiKey := os.Getenv("SIFT_API_KEY") grpcBaseURL := os.Getenv("SIFT_GRPC_BASE_URL") portStr := os.Getenv("PORT_NUM") if apiKey == "" || grpcBaseURL == "" || portStr == "" { log.Fatalf("Please set SIFT_API_KEY, SIFT_GRPC_BASE_URL, and PORT_NUM environment variables") } port, err := strconv.Atoi(portStr) if err != nil { log.Fatalf("Invalid PORT_NUM: %v", err) } client, err := sift.NewClient(context.Background(), "https://"+grpcBaseURL, port, sift.WithAPIKey(apiKey)) if err != nil { log.Fatalf("Failed to create Sift client: %v", err) } // Example usage: List services (replace with your actual API call) // services, err := client.ListServices(context.Background(), &siftpb.ListServicesRequest{}) // if err != nil { // log.Fatalf("Failed to list services: %v", err) // } // log.Printf("Services: %+v", services) log.Println("Sift client connected successfully (example usage commented out).") } ``` -------------------------------- ### Example Flow and Channel Configuration (Pseudo-code) Source: https://docs.siftstack.com/docs/ingestion/ingestion-config-based-streaming/flows Illustrates the creation of a flow named 'reading' with one double channel and one string channel using pseudo-code. This sets up the structure for data ingestion. ```pseudo-code flowConfig: { name: "reading", channels: [ { name: "velocity", type: DOUBLE }, { name: "log", type: STRING } ] } ``` -------------------------------- ### Assemble Main Function and Send Data in Go Source: https://docs.siftstack.com/docs/ingestion/client-libraries/go Assemble the main function to send data to Sift. This includes setting up the client, retrieving or creating the ingestion config, creating a run, and streaming sensor data. ```go func main() { ctx := context.Background() apiKey := os.Getenv("SIFT_API_KEY") if apiKey == "" { panic("SIFT_API_KEY is not set") } siftURL := os.Getenv("SIFT_URL") if siftURL == "" { panic("SIFT_URL is not set") } assetId := "NostromoLV426" clientKey := "NostromoLV426Key" c, err := client.NewClient(apiKey, &client.Options{ SiftURL: siftURL, }) if err != nil { panic(err) } ingestConfig, err := get_or_create_ingestion_config(ctx, c, &clientKey) if err != nil { panic(err) } run, err := create_run(ctx, c, assetId) if err != nil { panic(err) } ctx, cancel := context.WithCancel(ctx) defer cancel() ch := make(chan client.SensorData) err = c.StreamSensorData(ctx, assetId, run.Id, ingestConfig.Id, ch) if err != nil { panic(err) } go data_source(ctx, ch) time.Sleep(time.Second * 60) fmt.Println("Done!") } ``` -------------------------------- ### ListRuns API Endpoint - cURL Source: https://docs.siftstack.com/docs/api/reference/rest/run-service/run-service_-list-runs Example of how to retrieve runs using the ListRuns API endpoint via cURL. This demonstrates a basic GET request to the specified endpoint. ```shell curl \ 'https://api.sift.com/v2/runs?pageSize=10&pageToken=string&filter=string&orderBy=string' \ --header 'Accept: application/json' ``` -------------------------------- ### RunService - CreateRun Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers/runs Create a new run. ```APIDOC ## POST /websites/siftstack/runs ### Description Create a new run. ### Method POST ### Endpoint /websites/siftstack/runs ### Parameters #### Request Body - **CreateRunRequest** (object) - Required - The details required to create a new run. ``` -------------------------------- ### List Active Users (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/user-service/user-service_-list-active-users Example cURL command to list active users using the Sift API. This demonstrates a basic GET request to the /api/v2/users endpoint. ```shell curl -X GET \ 'https://api.sift.com/v2/users' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer YOUR_API_TOKEN' ``` -------------------------------- ### List Panel Configurations Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers/panel_configuration Lists all panel configurations, with options for pagination, filtering, and ordering. ```APIDOC ## GET /websites/siftstack/panel_configurations/v1/panel_configuration ### Description Retrieves a list of panel configurations, supporting pagination, filtering, and sorting. ### Method GET ### Endpoint /websites/siftstack/panel_configurations/v1/panel_configuration ### Parameters #### Query Parameters - **page_size** (uint32) - Optional - The maximum number of panel configurations to return. Defaults to 50, max 1000. - **page_token** (string) - Optional - A token for retrieving the next page of results. - **filter** (string) - Optional - A CEL filter string for filtering results by 'name', 'created_date', or 'modified_date'. - **order_by** (string) - Optional - Specifies the order of results, e.g., "name" or "name desc". Defaults to ascending order by 'name'. ### Response #### Success Response (200) - **panel_configurations** (array of PanelConfiguration) - A list of panel configurations. - **next_page_token** (string) - A token to retrieve the next page of results, if available. #### Response Example ```json { "panel_configurations": [ { "panel_configuration_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "MyTimeSeriesPanel", "panel_type": "PANEL_TYPE_TIMESERIES" }, { "panel_configuration_id": "f0e9d8c7-b6a5-4321-fedc-ba9876543210", "name": "AnotherPanel", "panel_type": "PANEL_TYPE_TABLE" } ], "next_page_token": "some_next_page_token_value" } ``` ``` -------------------------------- ### Call ListAnnotationLogs API (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/annotation-log-service/annotation-log-service_-list-annotation-logs Example of how to call the ListAnnotationLogs API using cURL. This demonstrates the basic structure for making an HTTP GET request to retrieve annotation logs. ```bash curl -X GET \ 'https://YOUR_SIFT_API_ENDPOINT/v1/annotations/ANNOTATION_ID/logs?pageSize=50&pageToken=TOKEN&filter=kind%3D%3D%22some_kind%22' \ -H 'Accept: application/json' ``` -------------------------------- ### List Webhook Logs with cURL Source: https://docs.siftstack.com/docs/api/reference/rest/webhook-service/webhook-service_-list-webhook-logs Example of how to list webhook logs using cURL. This demonstrates making a GET request to the API endpoint with optional query parameters for filtering and pagination. ```shell curl -X GET "https://api.sift.com/v1/webhooks/logs?pageSize=50&pageToken=somePageToken&filter=webhook_id%3D%3D%27webhook-123%27&orderBy=created_date+desc" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Listing Services with grpcurl Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers You can use `grpcurl` to explore Sift's available gRPC services and endpoints directly from the command line. Ensure you replace placeholders with your actual gRPC endpoint and port. ```APIDOC ## List Available Services ### Description Lists all available gRPC services. ### Method `grpcurl` (command-line tool) ### Endpoint `[GRPC_BASE_URL]:[PORT_NUM]` ### Parameters #### Query Parameters - **$SIFT_GRPC_BASE_URL**: The base URL for Sift's gRPC endpoint. - **$PORT_NUM**: The required port number for the gRPC base URL (typically 443). ### Request Example ```bash grpcurl -plaintext $SIFT_GRPC_BASE_URL:$PORT_NUM list ``` ## List Endpoints of a Service ### Description Lists all endpoints for a specific gRPC service, such as `AssetService`. ### Method `grpcurl` (command-line tool) ### Endpoint `[GRPC_BASE_URL]:[PORT_NUM]` ### Parameters #### Query Parameters - **$SIFT_GRPC_BASE_URL**: The base URL for Sift's gRPC endpoint. - **$PORT_NUM**: The required port number for the gRPC base URL (typically 443). ### Request Example ```bash grpcurl -plaintext $SIFT_GRPC_BASE_URL:$PORT_NUM Sift.AssetService ``` ### Notes - Replace `$SIFT_GRPC_BASE_URL` and `$PORT_NUM` with your actual gRPC endpoint and port. - When running `grpcurl`, do not include `https://` in the base URL. The base URL should consist only of the hostname without any protocol prefix. - The `$PORT_NUM` placeholder should be replaced with `443`, which is the required port for the gRPC base URL in all environments. ``` -------------------------------- ### List Users (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/user-service/user-service_-list-users-v2 Example using cURL to list users from the Sift API. Demonstrates how to make a GET request to the ListUsers endpoint and includes common query parameters. ```bash curl -X GET "https://api.sift.com/v2/users:all \ --header "Authorization: Bearer YOUR_API_KEY" \ --header "Content-Type: application/json" \ --data-urlencode "pageSize=50" \ --data-urlencode "pageToken=some_token" \ --data-urlencode "filter=user_id = \"some_id\"" \ --data-urlencode "orderBy=created_date desc" ``` -------------------------------- ### Create a Run in Go Source: https://docs.siftstack.com/docs/ingestion/client-libraries/go Create a function to create a run for grouping asset data. Creating a run is optional but provides a mechanism to group together data for a single asset or multiple assets. ```go func create_run(ctx context.Context, c *client.Client, assetId string) (*client.Run, error) { run, err := c.CreateRun(ctx, assetId) if err != nil { return nil, fmt.Errorf("failed to create run: %w", err) } fmt.Printf("Run created: %s\n", run.Id) return run, nil } ``` -------------------------------- ### ListTags API Call (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/tag-service/tag-service_-list-tags-v2 Demonstrates how to list tags using the Sift API via a cURL command. This example shows a basic GET request to the /v2/tags endpoint. ```bash curl GET "https:///v2/tags" ``` -------------------------------- ### Verify and Tidy Go Module Dependencies Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers Commands to verify and tidy up your Go module dependencies. `go mod verify` checks that the dependencies are available and correctly downloaded, while `go mod tidy` adds any missing and removes any unused dependencies. ```bash go mod verify go mod tidy ``` -------------------------------- ### ListRuns API Endpoint - Python Source: https://docs.siftstack.com/docs/api/reference/rest/run-service/run-service_-list-runs Example of how to retrieve runs using the ListRuns API endpoint with Python's requests library. This demonstrates making an HTTP GET request to the API. ```python import requests url = "https://api.sift.com/v2/runs" params = { "pageSize": 10, "pageToken": "string", "filter": "string", "orderBy": "string" } headers = { "Accept": "application/json" } response = requests.get(url, params=params, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Build Explore link with run, assets, and channels Source: https://docs.siftstack.com/docs/ui/how-to-guides/explore/build-parameterized-explore-links Constructs an Explore v1 deep link pre-configured with a specific run, asset, and channels. The comma separator in the channels parameter needs to be percent-encoded. ```URL https://app.siftstack.com/explore?run=run-name&assets=asset-name&channels=max_ground_temp%2Cmax_air_temp ``` -------------------------------- ### List Calculated Channel Versions (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/calculated-channel-service/calculated-channel-service_-list-calculated-channel-versions2 Example of how to list calculated channel versions using cURL. This demonstrates a basic GET request to the specified endpoint. ```bash curl -X GET \/`v2`\/`organizations`\/{organizationId}\/`calculated-channels`\/{clientKey}\/`versions`?pageSize=50&pageToken=token&filter=`calculated_channel_id`%3D%3D%22channelId%22&orderBy=`created_date` ``` -------------------------------- ### Build Explore link with run, assets, channels, and time range Source: https://docs.siftstack.com/docs/ui/how-to-guides/explore/build-parameterized-explore-links Creates an Explore v1 deep link with specified run, asset, channels, and a custom time range. Both comma separators in channels and colons in ISO 8601 timestamps require percent-encoding. ```URL https://app.siftstack.com/explore?run=run-name&assets=asset-name&channels=max_ground_temp%2Cmax_air_temp&from=2021-09-25T10%3A14%3A11&to=2021-10-14T13%3A29%3A37 ``` -------------------------------- ### List Applicable Views (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-applicable-views Example of how to call the ListApplicableViews API endpoint using cURL. This demonstrates making a GET request to retrieve views applicable to assets or runs. ```bash curl -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://sift.googleapis.com/v1/views:applicable?pageSize=100&assetIds=asset1,asset2" ``` -------------------------------- ### Initialize Sift ingestion client and stream data in Python Source: https://docs.siftstack.com/docs/ingestion/client-libraries/python This Python code establishes a connection to Sift, creates an ingestion service, and streams the mock sensor data. It initializes an optional run to group the data and then iterates through the data source, sending each data point to Sift. ```python # Replace with your actual Sift URL SIFT_URL = "https://your-sift-instance.sift.com" API_KEY = "your-api-key" ingestion_client = IngestionClient(url=SIFT_URL, api_key=API_KEY) # Optionally create a run to group data run_id = "my-first-run" ingestion_run = IngestionRun(id=run_id) ingestion_service = ingestion_client.ingestion_service(telemetry_config=telemetry_config) # Stream data for timestamp, value in mock_data_source(): ingestion_service.send_data( asset_name=ASSET_NAME, run=ingestion_run, flow_name=FLOW_NAME, channel_name=CHANNEL_NAME, timestamp=timestamp, value=value ) print(f"Successfully streamed data to Sift for asset {ASSET_NAME}") ``` -------------------------------- ### CampaignService - CreateCampaign Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers/campaigns Create a new campaign with the provided details. ```APIDOC ## POST /websites/siftstack/campaigns/v1/campaigns ### Description Create a new campaign. ### Method POST ### Endpoint /websites/siftstack/campaigns/v1/campaigns ### Request Body - **CreateCampaignRequest** (object) - Required - The details required to create a new campaign. ### Response #### Success Response (201) - **CreateCampaignResponse** (object) - Contains information about the newly created campaign. ``` -------------------------------- ### PanelConfigurationService - CreatePanelConfiguration Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers/panel_configuration Creates a new panel configuration. ```APIDOC ## POST /websites/siftstack/panel_configurations/v1/panel_configurations ### Description Creates a panel configuration. ### Method POST ### Endpoint /websites/siftstack/panel_configurations/v1/panel_configurations ### Parameters #### Request Body - **panelConfiguration** (object) - Required - The panel configuration object to create. - **displayName** (string) - Required - The display name for the panel. - **panelType** (string) - Required - The type of the panel (e.g., "GRAPH", "TABLE"). - **plottedChannelType** (string) - Optional - The type of channel to plot (e.g., "LINE", "BAR"). ### Request Example ```json { "panelConfiguration": { "displayName": "New Dashboard Panel", "panelType": "GRAPH", "plottedChannelType": "LINE" } } ``` ### Response #### Success Response (200) - **name** (string) - The name of the newly created panel configuration. #### Response Example ```json { "name": "projects/siftstack/panelConfigurations/new-panel-id" } ``` ``` -------------------------------- ### Call ListAnnotationLogs API (Python) Source: https://docs.siftstack.com/docs/api/reference/rest/annotation-log-service/annotation-log-service_-list-annotation-logs Example of how to call the ListAnnotationLogs API using Python. This demonstrates making an HTTP GET request to retrieve annotation logs, including handling pagination and filtering. ```python import requests api_key = "YOUR_API_KEY" annotation_id = "ANNOTATION_ID" base_url = "https://YOUR_SIFT_API_ENDPOINT" url = f"{base_url}/v1/annotations/{annotation_id}/logs" params = { "pageSize": 50, "pageToken": "TOKEN", "filter": "kind==\"some_kind\"" } headers = { "Accept": "application/json", "Authorization": f"Bearer {api_key}" } response = requests.get(url, params=params, headers=headers) if response.status_code == 200: data = response.json() print(data) elif response.status_code == 401: print("Authentication failed. Check your API key.") else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### List Webhook Logs with Python Source: https://docs.siftstack.com/docs/api/reference/rest/webhook-service/webhook-service_-list-webhook-logs Example of how to list webhook logs using the Python Requests library. This demonstrates making a GET request to the API endpoint with optional query parameters for filtering and pagination. ```python import requests api_key = "YOUR_API_KEY" base_url = "https://api.sift.com/v1/webhooks/logs" params = { "pageSize": 50, "pageToken": "somePageToken", "filter": "webhook_id==\'webhook-123\'", "orderBy": "created_date desc" } headers = { "Authorization": f"Bearer {api_key}" } response = requests.get(base_url, params=params, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### List Applicable Views (Python) Source: https://docs.siftstack.com/docs/api/reference/rest/view-service/view-service_-list-applicable-views Example of how to call the ListApplicableViews API endpoint using Python. This shows how to construct and send a GET request to the Sift API to fetch applicable views. ```python from google.cloud import siftwrap_v1 def list_applicable_views_sample(project_id: str): client = siftwrap_v1.SiftClient() request = siftwrap_v1.ListApplicableViewsRequest(project=f"projects/{project_id}", page_size=50, asset_ids=["asset1", "asset2"]) page_result = client.list_applicable_views(request=request) for view in page_result: print(view.name) ``` -------------------------------- ### Configure Channels in Go Source: https://docs.siftstack.com/docs/ingestion/client-libraries/go Define the channels configuration for the asset. This example shows a single velocity channel. This function allows you to configure or add more channels later. ```go func configs() map[string]client.ChannelConfig { return map[string]client.ChannelConfig{ "mainmotor.velocity": { Type: "double", }, } } ``` -------------------------------- ### List Tags with Python Source: https://docs.siftstack.com/docs/api/reference/rest/tag-service/tag-service_-list-tags Example of how to list tags using Python. This snippet shows how to make an HTTP GET request to the Sift API's ListTags endpoint, including potential query parameters. ```python import requests url = "/api/v1/tags" headers = { "Content-Type": "application/json" } params = { "pageSize": 50, "pageToken": "string", "filter": "name=test*", "name": "test*" } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: print("Tags listed successfully:") print(response.json()) else: print(f"Error listing tags: {response.status_code}") print(response.text) ``` -------------------------------- ### IngestWithConfigDataStreamRequest Example (Pseudo-code) Source: https://docs.siftstack.com/docs/ingestion/ingestion-config-based-streaming/flows Demonstrates how to construct an IngestWithConfigDataStreamRequest for the 'reading' flow, emphasizing the preservation of channel order from the flow configuration. Shows how to include data for specific channels. ```pseudo-code ingestRequest: { flowName: "reading", values: [ { value: 12.5 }, { value: "log message" } ] } ``` -------------------------------- ### List Remote Files using cURL Source: https://docs.siftstack.com/docs/api/reference/rest/remote-file-service/remote-file-service_-list-remote-files Example of how to list remote files using a cURL command. This demonstrates a basic GET request to the /api/v1/remote-files endpoint. No specific dependencies are required beyond cURL itself. ```shell curl \ 'https://www.sift.com/api/v1/remote-files?pageSize=1000' \ --header 'Accept: application/json' \ --compressed ``` -------------------------------- ### IngestionConfigService_ListIngestionConfigs Source: https://docs.siftstack.com/docs/api/reference/protocol-buffers/ingestion_configs Lists all ingestion configurations, with optional filtering and pagination. ```APIDOC ## GET /v2/ingestion_configs ### Description Lists all ingestion configurations, with optional filtering and pagination. ### Method GET ### Endpoint /v2/ingestion_configs ### Parameters #### Query Parameters - **page_size** (uint32) - Optional - The maximum number of ingestion configs to return. Defaults to 50. Maximum is 1000. - **page_token** (string) - Optional - A page token, received from a previous `ListIngestionConfigs` call. - **filter** (string) - Optional - A Common Expression Language (CEL) filter string. Available fields: `ingestion_config_id`, `client_key`, `asset_id`, `created_date`, `modified_date`. ### Response #### Success Response (200) - **ingestion_configs** (array of IngestionConfig) - A list of ingestion configurations. - **ingestion_config_id** (string) - The ID of the ingestion configuration. - **asset_id** (string) - The ID of the asset. - **client_key** (string) - The client key of the ingestion configuration. - **next_page_token** (string) - A token to retrieve the next page of results. #### Response Example ```json { "ingestion_configs": [ { "ingestion_config_id": "ingest_conf_abc", "asset_id": "asset_xyz", "client_key": "unique_config_key_456" }, { "ingestion_config_id": "ingest_conf_def", "asset_id": "asset_uvw", "client_key": "another_key_789" } ], "next_page_token": "page_token_123" } ``` ``` -------------------------------- ### List Calculated Channels (cURL) Source: https://docs.siftstack.com/docs/api/reference/rest/calculated-channel-service/calculated-channel-service_-list-calculated-channels Example of how to list calculated channels using cURL. This demonstrates making an HTTP GET request to the Sift API endpoint with optional query parameters for filtering and pagination. ```shell curl -X GET \"https://api.sift.com/v2/calculated-channels?pageSize=10&pageToken=some_token&filter=name%3D%3D%5C%27my_channel%5C%27&organizationId=org_id&orderBy=created_date%20desc\" \\ --header \"Authorization: Bearer YOUR_API_KEY\" ```