### Getting Started with ScreenshotOne Source: https://screenshotone.com/docs/llms An introductory guide for new users, covering the initial setup, API key management, and basic steps to take your first screenshot. ```en https://screenshotone.com/docs/getting-started/ ``` -------------------------------- ### Install Go SDK Source: https://screenshotone.com/docs/code-examples/go Install the ScreenshotOne Go SDK using the go get command. ```bash go get github.com/screenshotone/gosdk ``` -------------------------------- ### Python SDK and Code Examples Source: https://screenshotone.com/docs/llms Guides Python developers on integrating ScreenshotOne. It provides installation instructions and illustrative code snippets for common use cases. ```python https://screenshotone.com/docs/code-examples/python/ ``` -------------------------------- ### Go SDK Installation Source: https://screenshotone.com/docs/llms-full Installs the Screenshotone Go SDK using the go get command. This is the first step to using the SDK in your Go projects. ```shell go get github.com/screenshotone/gosdk ``` -------------------------------- ### PHP SDK and Code Examples Source: https://screenshotone.com/docs/llms Documentation for using the ScreenshotOne SDK in PHP projects. It covers installation and provides code examples for various screenshotting functionalities. ```php https://screenshotone.com/docs/code-examples/php/ ``` -------------------------------- ### Java SDK and Code Examples Source: https://screenshotone.com/docs/llms Details how to use the ScreenshotOne SDK with Java. This section includes setup, configuration, and practical code examples for Java-based workflows. ```java https://screenshotone.com/docs/code-examples/java/ ``` -------------------------------- ### Ruby SDK and Code Examples Source: https://screenshotone.com/docs/llms Resources for Ruby developers to integrate ScreenshotOne. This includes gem installation and code examples for performing screenshot operations. ```ruby https://screenshotone.com/docs/code-examples/ruby/ ``` -------------------------------- ### Install Ruby ScreenshotOne Gem Source: https://screenshotone.com/docs/code-examples/ruby Instructions for adding the ScreenshotOne Ruby SDK to your project's Gemfile and installing it using Bundler. ```Ruby gem 'screenshotone' ``` ```Terminal bundle install ``` -------------------------------- ### Go SDK and Code Examples Source: https://screenshotone.com/docs/llms Offers guidance and code samples for integrating ScreenshotOne functionality into Go projects. Covers installation and usage patterns for Go developers. ```go https://screenshotone.com/docs/code-examples/go/ ``` -------------------------------- ### C# (.NET) SDK and Code Examples Source: https://screenshotone.com/docs/llms Provides resources for using the ScreenshotOne SDK in C# (.NET) applications. Includes setup instructions and code examples for common screenshotting tasks. ```csharp https://screenshotone.com/docs/code-examples/c-net/ ``` -------------------------------- ### Python SDK Example: Basic Screenshot Source: https://screenshotone.com/docs/guides/performance A basic example demonstrating how to take a screenshot using the ScreenshotOne Python SDK, setting basic options. ```python from screenshotone import ScreenshotOne api_key = "YOUR_API_KEY" screenshotone = ScreenshotOne(api_key) url = "https://example.com" # Basic screenshot response = screenshotone.take(url) # Save to a file with open("screenshot.png", "wb") as f: f.write(response.content) print("Screenshot saved to screenshot.png") ``` -------------------------------- ### ScreenshotOne API - Take Screenshot Source: https://screenshotone.com/docs/getting-started This section details how to take screenshots using the ScreenshotOne API. It covers both GET and POST request methods, including how to pass parameters like URL and access key, and how to specify options. ```APIDOC ScreenshotOne API - Take Screenshot Endpoint Endpoint: GET https://api.screenshotone.com/take POST https://api.screenshotone.com/take Description: The /take endpoint is used to capture screenshots of web pages. It supports both GET and POST HTTP methods. GET Request: Send a GET request to: https://api.screenshotone.com/take?[options] Example: GET https://api.screenshotone.com/take?url=https://apple.com&access_key= POST Request: Send a POST request to: https://api.screenshotone.com/take with options specified as JSON in the request body. Headers: Content-Type: application/json Body: { "url": "https://example.com", "access_key": "", "...options": "..." } Access Key Management: The access key can be provided in multiple ways: 1. As a GET parameter: `?access_key=` 2. In the POST JSON body: `{"access_key": ""}` 3. As an HTTP header: `X-Access-Key: ` Parameters: url (string, required): The URL of the page to screenshot. access_key (string, required): Your ScreenshotOne API access key. [options] (various): Additional parameters to customize the screenshot (e.g., viewport width, height, format, etc.). Refer to /docs/options for a full list. ``` -------------------------------- ### Install ScreenshotOne PHP SDK Source: https://screenshotone.com/docs/code-examples/php Installs the ScreenshotOne PHP SDK using Composer. This is the first step to integrate screenshot functionality into your PHP applications. ```bash composer require screenshotone/sdk:^1.0 ``` -------------------------------- ### Install ScreenshotOne .NET SDK via .NET CLI Source: https://screenshotone.com/docs/code-examples/c-net Installs the ScreenshotOne .NET SDK package using the .NET Command-Line Interface. This command adds the necessary SDK package to your project. ```bash dotnet add package ScreenshotOne.dotnetsdk ``` -------------------------------- ### Install ScreenshotOne Python SDK Source: https://screenshotone.com/docs/code-examples/python Installs the official ScreenshotOne Python SDK using pip. This package provides the necessary tools to interact with the ScreenshotOne API for taking screenshots. ```bash pip install screenshotone ``` -------------------------------- ### Install ScreenshotOne .NET SDK via .NET CLI Source: https://screenshotone.com/docs/llms-full Instructions for installing the ScreenshotOne .NET SDK using the .NET CLI. ```bash dotnet add package ScreenshotOne.dotnetsdk ``` -------------------------------- ### Install ScreenshotOne .NET SDK via NuGet Source: https://screenshotone.com/docs/code-examples/c-net Installs the ScreenshotOne .NET SDK package using the NuGet Package Manager Console. This is the first step to integrate the SDK into your .NET project. ```bash PM> Install-Package ScreenshotOne.dotnetsdk ``` -------------------------------- ### JavaScript/TypeScript (Node.js) SDK and Code Examples Source: https://screenshotone.com/docs/llms Provides comprehensive examples and setup for using ScreenshotOne with JavaScript and TypeScript in a Node.js environment. Covers API interaction and SDK usage. ```javascript https://screenshotone.com/docs/code-examples/javascript-and-typescript-nodejs/ ``` -------------------------------- ### Install ScreenshotOne .NET SDK via NuGet Source: https://screenshotone.com/docs/llms-full Instructions for installing the ScreenshotOne .NET SDK using the NuGet package manager console. ```bash PM> Install-Package ScreenshotOne.dotnetsdk ``` -------------------------------- ### JavaScript SDK Example: Full Page Screenshot Source: https://screenshotone.com/docs/guides/performance Example of capturing a full-page screenshot using the ScreenshotOne JavaScript (Node.js) SDK with specific wait conditions. ```javascript const ScreenshotOne = require('screenshotone'); const apiKey = 'YOUR_API_KEY'; const screenshotone = new ScreenshotOne(apiKey); const url = 'https://example.com'; // Take a full page screenshot, waiting for network idle const options = { full_page: true, wait_options: { wait_until: 'networkidle0', timeout: 30000 // 30 seconds timeout } }; screenshotone.take(url, options) .then(response => { // response is a Buffer require('fs').writeFileSync('full_page_screenshot.png', response); console.log('Full page screenshot saved.'); }) .catch(error => { console.error('Error taking screenshot:', error); }); ``` -------------------------------- ### Go SDK Example: Disabling Ads and Trackers Source: https://screenshotone.com/docs/guides/performance Example showing how to disable ad blocking and tracker blocking for a screenshot using the ScreenshotOne Go SDK. ```go package main import ( "fmt" "io/ioutil" "log" "os" "github.com/screenshotone/screenshotone-go" ) func main() { apiKey := "YOUR_API_KEY" sclient := screenshotone.NewClient(apiKey) url := "https://example.com" options := screenshotone.Options{ BlockAds: false, BlockTrackers: false, Width: 1024, Height: 768, } resp, err := client.TakeScreenshot(url, options) if err != nil { log.Fatalf("Failed to take screenshot: %v", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatalf("Failed to read response body: %v", err) } err = ioutil.WriteFile("screenshot_no_blocking.png", body, 0644) if err != nil { log.Fatalf("Failed to write file: %v", err) } fmt.Println("Screenshot without blocking saved.") } ``` -------------------------------- ### Ruby SDK Example: Wait Options Source: https://screenshotone.com/docs/guides/performance Demonstrates configuring wait options, such as waiting until network is idle, with the ScreenshotOne Ruby SDK. ```ruby require 'screenshotone' api_key = 'YOUR_API_KEY' client = Screenshotone::Client.new(api_key) url = 'https://example.com' options = { wait_options: { wait_until: 'networkidle0', timeout: 20000 # 20 seconds } } begin response = client.take_screenshot(url, options) File.open('screenshot_wait_idle.png', 'wb') do |f| f.write(response.body) end puts 'Screenshot with wait options saved.' rescue Screenshotone::Error => e puts "Error taking screenshot: #{e.message}" end ``` -------------------------------- ### API Guide: How to use proxies Source: https://screenshotone.com/docs/guides/performance This link leads to a guide explaining how to configure and utilize proxy servers with the ScreenshotOne API. ```APIDOC API Guide: How to use proxies - Purpose: Enables users to route screenshot requests through specified proxy servers. - Parameters: Details proxy configuration options (e.g., IP, port, authentication). - Use Cases: Accessing geo-restricted content, managing IP reputation. - Link: /docs/guides/how-to-use-proxies/ ``` -------------------------------- ### General SDK and Code Examples Source: https://screenshotone.com/docs/llms A central hub for SDKs and code examples across various languages. This page links to specific language documentation for broader integration support. ```en https://screenshotone.com/docs/code-examples/ ``` -------------------------------- ### Install Java SDK Dependency (Maven) Source: https://screenshotone.com/docs/code-examples/java This snippet shows how to add the ScreenshotOne Java SDK to your Maven project by including the necessary dependency in your pom.xml file. It specifies the group ID, artifact ID, and a version range for the SDK. ```xml com.screenshotone.jsdk screenshotone-api-jsdk [1.0.0,2.0.0) ``` -------------------------------- ### Example: PDF Rendering Configuration Source: https://screenshotone.com/docs/llms-full Provides a query string example for generating a PDF that includes background graphics and fits content onto a single page. ```http format=pdf&media_type=screen&pdf_print_background=true&pdf_fit_one_page=true ``` -------------------------------- ### Install ScreenshotOne Node.js SDK Source: https://screenshotone.com/docs/code-examples/javascript-and-typescript-nodejs Installs the official ScreenshotOne API SDK for Node.js using npm. This package enables programmatic screenshot generation and management within your JavaScript or TypeScript applications. ```bash npm install screenshotone-api-sdk --save ``` -------------------------------- ### C# (.NET) SDK Example: Image Quality and Format Source: https://screenshotone.com/docs/guides/performance Demonstrates how to configure image format and quality when taking screenshots with the ScreenshotOne C# (.NET) SDK. ```csharp using ScreenshotOne; using System.IO; public class ScreenshotExample { public static void Main(string[] args) { string apiKey = "YOUR_API_KEY"; var screenshotone = new ScreenshotOneClient(apiKey); string url = "https://example.com"; var options = new ScreenshotOneOptions { Format = "jpeg", // or "webp" Quality = 90, // Quality between 1 and 100 Width = 1280, Height = 720 }; var response = screenshotone.TakeScreenshot(url, options); File.WriteAllBytes("screenshot_high_quality.jpg", response.Content); Console.WriteLine("High quality JPEG screenshot saved."); } } ``` -------------------------------- ### Ruby: Install SDK Source: https://screenshotone.com/docs/llms-full Adds the ScreenshotOne Ruby gem to your project's Gemfile and installs it using Bundler. ```shell gem 'screenshotone' ``` ```shell bundle install ``` -------------------------------- ### Slack Webhook Setup Guide Source: https://screenshotone.com/docs/notifications Instructions for configuring Slack notifications by creating a Slack application and setting up incoming webhooks. This involves creating an app, enabling webhooks, adding a webhook to your workspace, and copying the URL. ```APIDOC Slack Notification Setup: 1. Create a Slack application: - Navigate to https://api.slack.com/apps/new to create a new Slack application. 2. Enable Incoming Webhooks: - Within your Slack application settings, enable the 'Incoming Webhooks' feature. 3. Add New Webhook to Workspace: - After enabling, add a new webhook integration to your Slack workspace. 4. Copy the Webhook URL: - A unique webhook URL will be generated. This URL is used to send messages to your Slack channel. 5. Save and Test: - Save the webhook URL in the ScreenshotOne dashboard under notifications settings. - Test the integration to ensure messages are received. 6. Receive Limit Notifications: - Once configured, you will receive notifications in your designated Slack channel when you reach 90% or 100% of your screenshot limit. ``` -------------------------------- ### ScreenshotOne Go SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for Go to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```Go // This is a placeholder for Go SDK example code. // Actual code would involve importing the ScreenshotOne SDK, // initializing a client with credentials, and calling capture methods. // Example: // import "github.com/screenshotone/screenshotone-sdk-go" // // client := screenshotone.NewClient("YOUR_ACCESS_KEY", "YOUR_SIGNATURE") // resp, err := client.Capture( // screenshotone.CaptureOptions{ // URL: "https://example.com", // Format: "png", // }, // ) // if err != nil { // log.Fatal(err) // } // ioutil.WriteFile("screenshot.png", resp.Body, 0644) ``` -------------------------------- ### PHP SDK Example: Viewport and Device Scale Factor Source: https://screenshotone.com/docs/guides/performance Illustrates setting custom viewport dimensions and device scale factor using the ScreenshotOne PHP SDK. ```php 1366, 'height' => 768, 'device_scale_factor' => 1.5 ]; try { $response = $client->takeScreenshot($url, $options); file_put_contents('screenshot_custom_viewport.png', $response->getBody()); echo 'Screenshot with custom viewport saved.\n'; } catch (\Exception $e) { echo 'Error taking screenshot: ' . $e->getMessage() . '\n'; } ?> ``` -------------------------------- ### Python: Install SDK Source: https://screenshotone.com/docs/llms-full Installs the official ScreenshotOne Python SDK using pip. This command is executed in your terminal or command prompt. ```shell pip install screenshotone ``` -------------------------------- ### ScreenshotOne Ruby SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for Ruby to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```Ruby # This is a placeholder for Ruby SDK example code. # Actual code would involve requiring the ScreenshotOne gem, # initializing a client with credentials, and calling capture methods. # Example: # require 'screenshotone' # # client = Screenshotone.new("YOUR_ACCESS_KEY", "YOUR_SIGNATURE") # response = client.capture({ # url: 'https://example.com', # format: 'png' # }) # # File.open('screenshot.png', 'wb') { |f| f.write(response.body) } ``` -------------------------------- ### Guide: How to Render Website Screenshots with Bubble Source: https://screenshotone.com/docs/llms Provides a step-by-step guide for integrating ScreenshotOne with Bubble, a no-code platform, to automate website screenshot generation within visual workflows. ```en https://screenshotone.com/docs/no-code/bubble/ ``` -------------------------------- ### ScreenshotOne PHP SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for PHP to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```PHP capture([ // 'url' => 'https://example.com', // 'format' => 'png', // ]); // // file_put_contents('screenshot.png', $response->getBody()); ?> ``` -------------------------------- ### ScreenshotOne Python SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for Python to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```Python # This is a placeholder for Python SDK example code. # Actual code would involve importing the ScreenshotOne SDK, # initializing a client with credentials, and calling capture methods. # Example: # from screenshotone import ScreenshotoneClient # # client = ScreenshotoneClient("YOUR_ACCESS_KEY", "YOUR_SIGNATURE") # response = client.capture( # url='https://example.com', # format='png' # ) # # with open('screenshot.png', 'wb') as f: # f.write(response.content) ``` -------------------------------- ### ScreenshotOne Java SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for Java to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```Java // This is a placeholder for Java SDK example code. // Actual code would involve importing the ScreenshotOne SDK, // initializing a client with credentials, and calling capture methods. // Example: // import com.screenshotone.ScreenshotoneClient; // import com.screenshotone.CaptureOptions; // import java.nio.file.Files; // import java.nio.file.Paths; // // ScreenshotoneClient client = new ScreenshotoneClient("YOUR_ACCESS_KEY", "YOUR_SIGNATURE"); // CaptureOptions options = new CaptureOptions.Builder() // .url("https://example.com") // .format("png") // .build(); // // byte[] responseBody = client.capture(options); // Files.write(Paths.get("screenshot.png"), responseBody); ``` -------------------------------- ### ScreenshotOne API Error Response Format Source: https://screenshotone.com/docs/getting-started Illustrates the JSON structure returned by the ScreenshotOne API for error conditions. Errors include a human-readable message, an error code, and are accompanied by suitable HTTP status codes. ```json { "error": { "code": "an_error_code", "message": "An error message" } } ``` -------------------------------- ### API Guide: How to customize websites Source: https://screenshotone.com/docs/guides/performance This link offers guidance on modifying website appearance or behavior before taking a screenshot. ```APIDOC API Guide: How to customize websites - Purpose: Allows modification of website content or styles before rendering. - Techniques: May involve injecting CSS or JavaScript. - Use Cases: Hiding specific elements, changing themes, applying custom styling. - Link: /docs/guides/how-to-customize-any-website-before-screenshotting/ ``` -------------------------------- ### API Guide: How to take full-page screenshots Source: https://screenshotone.com/docs/guides/performance This link directs to a guide focused on capturing complete web pages, including scrolling content. ```APIDOC API Guide: How to take full-page screenshots - Purpose: Captures the entire scrollable content of a webpage. - Key Parameters: `full_page`, `full_page_scroll_algorithm`, `disable_full_page_scrolling`, `tune_full_page_scrolling`. - Algorithms: Explains different scrolling algorithms (`auto`, `scroll`, `css`) and their effectiveness. - Link: /docs/guides/full-page-screenshots/ ``` -------------------------------- ### Install ScreenshotOne Node.js SDK Source: https://screenshotone.com/docs/llms-full Installs the ScreenshotOne API SDK for Node.js using npm. This package enables programmatic screenshot generation and management. ```shell npm install screenshotone-api-sdk --save ``` -------------------------------- ### ScreenshotOne C# (.NET) SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for C# (.NET) to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```C# // This is a placeholder for C# (.NET) SDK example code. // Actual code would involve referencing the ScreenshotOne SDK, // initializing a client with credentials, and calling capture methods. // Example: // using Screenshotone; // using System.IO; // // var client = new ScreenshotoneClient("YOUR_ACCESS_KEY", "YOUR_SIGNATURE"); // var response = await client.CaptureAsync( // new CaptureOptions // { // Url = "https://example.com", // Format = "png" // } // ); // // File.WriteAllBytes("screenshot.png", response.Content.ReadAsByteArrayAsync().Result); ``` -------------------------------- ### API Guide: Translate and screenshot a website Source: https://screenshotone.com/docs/guides/performance This link provides instructions on how to translate website content before capturing a screenshot. ```APIDOC API Guide: Translate and screenshot a website - Purpose: Enables capturing screenshots of websites after translating their content. - Mechanism: May involve using browser translation features or external translation services. - Parameters: Likely includes language codes for translation. - Link: /docs/guides/how-to-translate-and-render-a-website-as-a-screenshot/ ``` -------------------------------- ### ScreenshotOne API Request Examples Source: https://screenshotone.com/docs/options Examples demonstrating how to construct API requests for taking screenshots using various parameters like URL, HTML, Markdown, and access keys. ```APIDOC https://api.screenshotone.com/take?url=https://apple.com&access_key= https://api.screenshotone.com/take?url=https://www.youtube.com/feed/explore&access_key= https://api.screenshotone.com/take?html=

Hello,%20world!

&access_key= https://api.screenshotone.com/take?html=%23%20Hello%2C%20world!&access_key= https://api.screenshotone.com/take?format=jpeg&url=https://apple.com&access_key= https://api.screenshotone.com/take?response_type=empty&url=https://example.com&access_key= ``` -------------------------------- ### Take Screenshot and Save to File (Go) Source: https://screenshotone.com/docs/code-examples/go Take a screenshot using the Go SDK and save the resulting image to a file. This example shows how to handle the image response and file operations. ```go import ( "context" "io" "os" screenshots "github.com/screenshotone/gosdk" ) client, err := screenshots.NewClient("IVmt2ghj9TG_jQ", "Sxt94yAj9aQSgg") if err != nil { // ... } options := screenshots.NewTakeOptions("https://example.com"). Format("png"). FullPage(true). DeviceScaleFactor(2). BlockAds(true). BlockTrackers(true) image, err := client.Take(context.TODO(), options) if err != nil { // ... } defer image.Close() out, err := os.Create("example.png") if err != nil { // ... } defer out.Close() io.Copy(out, image) ``` -------------------------------- ### ScreenshotOne Python SDK Usage Example Source: https://screenshotone.com/docs/code-examples/python Demonstrates how to use the ScreenshotOne Python SDK to capture screenshots. It shows client initialization with API keys, setting various screenshot options (like URL, format, viewport dimensions, and blocking elements), generating a shareable screenshot URL, and downloading the screenshot directly. ```python import shutil from screenshotone import Client, TakeOptions # create API client client = Client('', '') # set up options options = (TakeOptions.url('https://screenshotone.com') .format("png") .viewport_width(1024) .viewport_height(768) .block_cookie_banners(True) .block_chats(True)) # generate the screenshot URL and share it with a user url = client.generate_take_url(options) # expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fscreenshotone.com&viewport_width=1024&viewport_height=768&block_cookie_banners=True&block_chats=True&access_key=&signature=6afc9417a523788580fa01a9f668ea82c78a9d2b41441d2a696010bf2743170f # or render a screenshot and download the image as stream image = client.take(options) # store the screenshot the example.png file with open('example.png', 'wb') as result_file: shutil.copyfileobj(image, result_file) ``` -------------------------------- ### ScreenshotOne Node.js SDK Usage Example Source: https://screenshotone.com/docs/code-examples/javascript-and-typescript-nodejs Demonstrates how to use the ScreenshotOne Node.js SDK to create a client, configure screenshot options (like URL and delay), generate a take URL (signed or unsigned), and download a screenshot directly. It highlights the asynchronous nature of recent SDK versions and the importance of signed URLs. ```typescript import * as fs from "fs"; import * as screenshotone from "screenshotone-api-sdk"; // create API client const client = new screenshotone.Client("", ""); // set up options const options = screenshotone.TakeOptions.url("https://example.com") .delay(3) .blockAds(true); // generate URL const url = client.generateTakeURL(options); // or generateSignedTakeURL(options) for signed URLs console.log(url); // expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&delay=3&block_ads=true&access_key=%3Caccess+key%3E // or download the screenshot const imageBlob = await client.take(options); const buffer = Buffer.from(await imageBlob.arrayBuffer()); fs.writeFileSync("example.png", buffer); // the screenshot is store in the example.png file ``` -------------------------------- ### ScreenshotOne JavaScript/TypeScript SDK Example Source: https://screenshotone.com/docs/options Example of how to use the ScreenshotOne SDK for JavaScript and TypeScript (Node.js) to capture screenshots. This typically involves initializing the client and making API calls with specified options. ```JavaScript // This is a placeholder for JavaScript/TypeScript SDK example code. // Actual code would involve importing the ScreenshotOne SDK, // initializing a client with credentials, and calling capture methods. // Example: // import { ScreenshotoneClient } from 'screenshotone'; // import * as fs from 'fs'; // // const client = new ScreenshotoneClient('YOUR_ACCESS_KEY', 'YOUR_SIGNATURE'); // // async function captureScreenshot() { // const response = await client.capture({ // url: 'https://example.com', // format: 'png', // }); // // fs.writeFileSync('screenshot.png', response.data); // } // // captureScreenshot(); ``` -------------------------------- ### ScreenshotOne PHP SDK Usage Example Source: https://screenshotone.com/docs/code-examples/php Demonstrates how to use the ScreenshotOne PHP SDK to generate a screenshot URL or download an image. It requires access and secret keys and allows configuration of options like full page, delay, and geolocation. ```php ', ''); $options = TakeOptions::url("https://example.com") ->fullPage(true) ->delay(2) ->geolocationLatitude(48.857648) ->geolocationLongitude(2.294677) ->geolocationAccuracy(50); $url = $client->generateTakeUrl($options); echo $url.PHP_EOL; // expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com... $image = $client->take($options); file_put_contents('example.png', $image); // the screenshot is stored in the example.png file ``` -------------------------------- ### Example: Scroll to Element Source: https://screenshotone.com/docs/llms-full Demonstrates a URL request to take a screenshot after scrolling to an element with the ID 'faq'. ```http https://api.screenshotone.com/take?scroll_into_view=%23faq&url=https://screenshotone.com&access_key= ``` -------------------------------- ### Screenshot URLs Response Source: https://screenshotone.com/docs/llms-full Example JSON response containing an array of screenshot URLs for downloading. ```json { "responses": [ {"url": "https://api.screenshotone.com/take?url=http://example.com&viewport_width=1280&viewport_height=1024&block_ads=true"}, {"url": "https://api.screenshotone.com/take?url=https://finance.yahoo.com&viewport_width=1280&viewport_height=1024&block_ads=true&block_cookie_banners=true"}, {"url": "https://api.screenshotone.com/take?html=

Hello, world!

&viewport_width=1280&viewport_height=1024&block_ads=false&block_cookie_banners=true"} ] } ``` -------------------------------- ### Execution Response Structure Source: https://screenshotone.com/docs/llms-full Example response structure when executing bulk requests, showing the status of each individual screenshot task. ```json [ { "url": "https://api.screenshotone.com/take?url=http://example.com&viewport_width=1280&viewport_height=1024&block_ads=true", "response": { "is_successful": true, "status": 200, "statusText": "OK" } }, { "url": "https://api.screenshotone.com/take?url=https://finance.yahoo.com&viewport_width=1280&viewport_height=1024&block_ads=true&block_cookie_banners=true", "response": { "is_successful": true, "status": 200, "statusText": "OK" } }, { "url": "https://api.screenshotone.com/take?html=

Hello, world!

&viewport_width=1280&viewport_height=1024&block_ads=false&block_cookie_banners=true", "response": { "is_successful": true, "status": 200, "statusText": "OK" } }, { "url": "https://api.screenshotone.com/take?markdown=**Yes!**&viewport_width=1280&viewport_height=1024&block_ads=false&block_cookie_banners=true", "response": { "is_successful": true, "status": 200, "statusText": "OK" } } ] ``` -------------------------------- ### Ruby SDK Usage: Client Initialization and Screenshot Options Source: https://screenshotone.com/docs/code-examples/ruby Demonstrates how to initialize the ScreenshotOne client with API keys and configure screenshot parameters using the TakeOptions class. Includes setting URL, full page rendering, delay, and geolocation. ```Ruby # Initialize client without signature (for public URLs) client = ScreenshotOne::Client.new('my_access_key') # Initialize client with signature (for private URLs) client = ScreenshotOne::Client.new('my_access_key', 'my_secret_key') # Configure screenshot options options = ScreenshotOne::TakeOptions.new(url: 'https://example.com'). full_page(true). delay(2). geolocation_latitude(48.857648). geolocation_longitude(2.294677). geolocation_accuracy(50) # Validate options before use options.valid? # => true # Generate the screenshot URL client.generate_take_url(options) # => "https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com..." # Take the screenshot and get the image data client.take(options) # => "\xFF\xD8\xFF\xE0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xFF\..." ``` -------------------------------- ### Ruby: Initialize Client and Set Options Source: https://screenshotone.com/docs/llms-full Shows how to initialize the ScreenshotOne Ruby client with access and secret keys, and how to configure screenshot options using a fluent interface. This prepares for generating URLs or capturing screenshots. ```ruby # If you don't need to add a signature client = ScreenshotOne::Client.new('my_access_key') # If you do need to add a signature client = ScreenshotOne::Client.new('my_access_key', 'my_secret_key') # You can set any available option, in a camel_case format, for example: options = ScreenshotOne::TakeOptions.new(url: 'https://example.com'). full_page(true). delay(2). geolocation_latitude(48.857648). geolocation_longitude(2.294677). geolocation_accuracy(50) # Verify all the parameters are valid (we will validate the parameters that should be # numeric, booleans or that accept only certain values) options.valid? => true ``` -------------------------------- ### Configure Wait Until Option Source: https://screenshotone.com/docs/guides/performance Specify when the rendering process should consider the page loaded. Starting with `wait_until=load` is a common practice, but for full-page screenshots with scrolling, waiting for all elements might be unnecessary. ```config wait_until=load ``` -------------------------------- ### Embed ScreenshotOne Image in HTML Source: https://screenshotone.com/docs/getting-started Demonstrates how to embed a screenshot generated by the ScreenshotOne API directly into an HTML `` tag. The API automatically sets the `Content-Type` header based on the requested format. ```html A screenshot of apple.com ``` -------------------------------- ### Go SDK Take Screenshot and Save Source: https://screenshotone.com/docs/llms-full Shows how to take a screenshot and save the resulting image to a file using the Go SDK. It includes client initialization, option configuration, taking the screenshot, and file handling. ```go import ( screenshots "github.com/screenshotone/gosdk" "context" "os" "io" "fmt" ) func main() { client, err := screenshots.NewClient("IVmt2ghj9TG_jQ", "Sxt94yAj9aQSgg") if err != nil { // Handle error fmt.Printf("Error creating client: %v\n", err) return } options := screenshots.NewTakeOptions("https://example.com"). Format("png"). FullPage(true). DeviceScaleFactor(2). BlockAds(true). BlockTrackers(true) image, err := client.Take(context.TODO(), options) if err != nil { // Handle error fmt.Printf("Error taking screenshot: %v\n", err) return } defer image.Close() out, err := os.Create("example.png") if err != nil { // Handle error fmt.Printf("Error creating file: %v\n", err) return } defer out.Close() _, err = io.Copy(out, image) if err != nil { // Handle error fmt.Printf("Error writing image to file: %v\n", err) return } fmt.Println("Screenshot saved to example.png") } ``` -------------------------------- ### ScreenshotOne API Error: Invalid Header Parameter Source: https://screenshotone.com/docs/errors/invalid-header-parameter Details the 'invalid_header_parameter' error, including an example JSON response and correct formatting for the 'headers' parameter in both GET (query string) and POST (request body) requests. ```APIDOC ScreenshotOne API Error: Invalid Header Parameter It is an API error returned when the `headers` parameter is invalid. Error Response Example: ```json { "is_successful": false, "error_message": "The `headers` parameters you provided are invalid. Please, consider providing different values and adhere to the format specified in the ScreenshotOne documentation.", "error_code": "invalid_header_parameter", "documentation_url": "https://screenshotone.com/docs/errors/invalid-header-parameter/" } ``` Reasons and how to fix: Make sure you adhere to the format specified in the [ScreenshotOne options documentation](https://screenshotone.com/docs/options/#headers). For GET requests, your headers must be in the query string as: ``` headers=name1:val1&headers=name2:val2 ``` For POST requests, your headers must be in the request body as: ```json { // ... "headers": ["name1:val1", "name2:val2"] // ... } ``` ``` -------------------------------- ### ScreenshotOne API: Invalid Cookie Parameter Error Source: https://screenshotone.com/docs/llms-full Details the 'invalid_cookie_parameter' API error, its common causes related to cookie formatting, and provides examples of correct cookie string formats for GET and POST requests. Includes the JSON error response structure. ```json { "is_successful": false, "error_message": "The `cookies` parameters you provided are invalid. Please, consider providing different values and adhere to the format specified in the ScreenshotOne documentation.", "error_code": "invalid_cookie_parameter", "documentation_url": "https://screenshotone.com/docs/errors/invalid-cookie-parameter/" } ``` ```APIDOC ScreenshotOne Cookie Parameter Formatting: GET Request Format: `cookies=name1=val1; Domain=example.com; Secure; HttpOnly` Note: The string must be URL-encoded. Multiple Cookies (GET): `cookies=name1=val1; Domain=example.com; Secure; HttpOnly&cookies=name2=val2; Domain=example.com; Secure; HttpOnly` POST Request Format: ```json { // ... "headers": ["name1:val1", "name2:val2"] // ... } ``` ``` -------------------------------- ### ScreenshotOne API: Invalid Header Parameter Error Source: https://screenshotone.com/docs/llms-full Details the 'invalid_header_parameter' API error, its causes related to header formatting, and provides examples for specifying headers in GET requests (query string) and POST requests (request body). Includes the JSON error response structure. ```json { "is_successful": false, "error_message": "The `headers` parameters you provided are invalid. Please, consider providing different values and adhere to the format specified in the ScreenshotOne documentation.", "error_code": "invalid_header_parameter", "documentation_url": "https://screenshotone.com/docs/errors/invalid-header-parameter/" } ``` ```APIDOC ScreenshotOne Header Parameter Formatting: GET Request Format (Query String): `headers=name1:val1&headers=name2:val2` POST Request Format (Request Body): ```json { // ... "headers": ["name1:val1", "name2:val2"] // ... } ``` ``` -------------------------------- ### ScreenshotOne SDK Usage: Generate URL and Download Source: https://screenshotone.com/docs/llms-full Demonstrates how to initialize the ScreenshotOne SDK client, configure screenshot options (like URL, delay, ad blocking), generate a take URL, and download a screenshot. It highlights the importance of `generateSignedTakeURL` for security. ```javascript import * as fs from "fs"; import * as screenshotone from "screenshotone-api-sdk"; // create API client const client = new screenshotone.Client("", ""); // set up options const options = screenshotone.TakeOptions.url("https://example.com") .delay(3) .blockAds(true); // generate URL const url = client.generateTakeURL(options); // or generateSignedTakeURL(options) for signed URLs console.log(url); // expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&delay=3&block_ads=true&access_key=%3Caccess+key%3E // or download the screenshot const imageBlob = await client.take(options); const buffer = Buffer.from(await imageBlob.arrayBuffer()); fs.writeFileSync("example.png", buffer); // the screenshot is store in the example.png file ``` -------------------------------- ### API Guide: How to handle API errors Source: https://screenshotone.com/docs/guides/performance This link points to a guide on managing and responding to API errors encountered during screenshot generation. ```APIDOC API Guide: How to handle API errors - Purpose: Provides strategies for identifying, interpreting, and recovering from API errors. - Content: Details common error codes, their meanings, and recommended actions. - Related Guides: Performance optimization, troubleshooting common issues. - Link: /docs/guides/how-to-handle-api-errors/ ``` -------------------------------- ### n8n Workflow Guide: Google Sheets & Drive Integration Source: https://screenshotone.com/docs/no-code/n8n A guide detailing how to capture URL screenshots automatically from Google Sheets and Drive using ScreenshotOne, with Gmail alerts. This workflow demonstrates a practical application of automated screenshots. ```text Guide: Capture URL Screenshots Automatically from Google Sheets & Drive with ScreenshotOne & Gmail Alerts Link: https://n8n.io/workflows/3321-capture-url-screenshots-from-google-sheets-with-screenshotone-and-save-to-drive-with-gmail-alerts/ ``` -------------------------------- ### API Guide: Screenshot Google Documents Source: https://screenshotone.com/docs/guides/performance This link offers guidance on capturing screenshots of Google Documents. ```APIDOC API Guide: Screenshot Google Documents - Purpose: Captures screenshots of Google Documents. - Specifics: May involve handling document rendering, pagination, or specific access methods. - Link: /docs/guides/screenshot-google-docs/ ``` -------------------------------- ### API Guide: How to screenshot an area of a site Source: https://screenshotone.com/docs/guides/performance This link details how to capture only a specific portion or region of a webpage. ```APIDOC API Guide: How to screenshot an area of a site - Purpose: Captures a specific rectangular region of a webpage. - Parameters: Likely involves `clip` or `crop` options with coordinates (x, y, width, height). - Use Cases: Extracting specific UI elements or sections of a page. - Link: /docs/guides/how-to-screenshot-an-area-of-a-site/ ``` -------------------------------- ### Generate Screenshot URL (Go) Source: https://screenshotone.com/docs/code-examples/go Generate a screenshot URL using the Go SDK without executing the request. Demonstrates client initialization and option configuration for a screenshot. ```go import screenshots "github.com/screenshotone/gosdk" client, err := screenshots.NewClient("IVmt2ghj9TG_jQ", "Sxt94yAj9aQSgg") if err != nil { // ... } options := screenshots.NewTakeOptions("https://scalabledeveloper.com"). Format("png"). FullPage(true). DeviceScaleFactor(2). BlockAds(true). BlockTrackers(true) u, err := client.GenerateTakeURL(options) if err != nil { // ... } fmt.Println(u.String()) ``` -------------------------------- ### API Guide: How to bypass CAPTCHAs Source: https://screenshotone.com/docs/guides/performance This link provides information on strategies for handling and potentially bypassing CAPTCHAs during screenshot generation. ```APIDOC API Guide: How to bypass CAPTCHAs - Purpose: Offers methods to handle pages protected by CAPTCHA mechanisms. - Techniques: May involve specific wait strategies, JavaScript execution, or integration with CAPTCHA solving services. - Limitations: CAPTCHA bypassing can be complex and may not always be successful. - Link: /docs/guides/how-to-bypass-captchas/ ``` -------------------------------- ### Guide: How to Use Proxies Source: https://screenshotone.com/docs/llms Details the configuration and usage of proxy servers with ScreenshotOne to manage IP addresses, bypass geo-restrictions, or route traffic for screenshot generation. ```en https://screenshotone.com/docs/guides/how-to-use-proxies/ ```