Skip to main content
Skip table of contents

Screenshot API

LAST UPDATED: 07/03/2024

Overview

ScreenshotAPI is a simple API that allows you to take programmatic screenshots of any website with ease.

D3 SOAR is providing REST operations to function with Screenshot API.

Screenshot API is available for use in:

D3 SOAR

V16.8+

Category

Other

Deployment Options

Option II, Option IV

Connection

To connect to Screenshot API from D3 SOAR, please follow this part to collect the required information below:

Parameter

Description

Example

Server URL

The server URL for the API connection.

https://shot.screenshotapi.net

API Key

The API Key to authenticate the API connection.

API_KEY

Configuring Screenshot API to Work with D3 SOAR

  1. For obtaining an existing API key, please refer to screenshotapi.net.

  2. For issuing a fresh API key and revoking access from the previous key, click Roll API Key in the Settings card on the Dashboard.

Configuring D3 SOAR to Work with Screenshot API

  1. Log in to D3 SOAR.

  2. Find the Screenshot API integration.

    1. Navigate to Configuration on the top header menu.

    2. Click on the Integration icon on the left sidebar.

    3. Type Screenshot API in the search box to find the integration, then click it to select it.

    4. Click + Connection, on the right side of the Connections section. A new connection window will appear.

  3. Configure the following fields to create a connection to Screenshot API.

    1. Connection Name: The desired name for the connection.

    2. Site: Specifies the site to use the integration connection. Use the drop-down menu to select the site. The Share to Internal Sites option enables all sites defined as internal sites to use the connection. Selecting a specific site will only enable that site to use the connection.

    3. Recipient site for events from connections Shared to Internal Sites: This field appears if you selected Share to Internal Sites for Site to let you select the internal site to deploy the integration connection.

    4. Agent Name (Optional): Specifies the proxy agent required to build the connection. Use the dropdown menu to select the proxy agent from a list of previously configured proxy agents.

    5. Description (Optional): Add your desired description for the connection.

    6. Tenant (Optional): When configuring the connection from a master tenant site, you have the option to choose the specific tenant sites you want to share the connection with. Once you enable this setting, you can filter and select the desired tenant sites from the dropdowns to share the connection.

    7. Configure User Permissions: Defines which users have access to the connection.

    8. Active: Check the tick box to ensure the connection is available for use.

    9. System: This section contains the parameters defined specifically for the integration. These parameters must be configured to create the integration connection.
      1. Input your domain level Server URL.
      2. Input your API Token.
      3. Input the API Version. The default value is v1.

    10. Enable Password Vault: An optional feature that allows users to take the stored credentials from their own password vault. Please refer to the password vault connection guide if needed.

    11. Connection Health Check: Updates the connection status you have created. A connection health check is done by scheduling the Test Connection command of this integration. This can only be done when the connection is active.
      To set up a connection health check, check the Connection Health Check tickbox. You can customize the interval (minutes) for scheduling the health check. An email notification can be set up after a specified number of failed connection attempts.

  4. Test the connection.

    1. Click Test Connection to verify the account credentials and network connection. If the Test Connection Passed alert window appears, the test connection is successful. You will see Passed with a green checkmark appear beside the Test Connection button. If the test connection fails, please check your connection parameters and try again.

    2. Click OK to close the alert window.

    3. Click + Add to create and add the configured connection.

Commands

Screenshot API includes the following executable commands for users to set up schedules or create playbook workflows. With the Test Command, you can execute these commands independently for playbook troubleshooting.

Integration API Note

For more information about the Screenshot API API, please refer to the Screenshot API API reference.

Capture Webpage Screenshots

Serves as a utility for capturing screenshots of webpages. It can generate a screenshot of either the entire webpage or a specified portion, and retrieves it as either a binary data stream or an image link. Both outputs can be directly saved to a file in the D3 system.

Input

Input Parameter

Required/Optional

Description

Example

URLs

Required

The URL(s) of the website(s) for the screenshot(s).

["https://apple.com"]

Screenshot Type

Optional

The type of screenshot to capture. Available options are: Single page screenshot, Full page screenshot, or Scrolling screenshot. The default vale is Single page screenshot.

Single Page Screenshot

File Type

Optional

The format for saving screenshots, with available options depending on the value of the Screenshot Type parameter.

For Screenshot Type = Single Page Screenshots, the available options are: PNG, JPEG, WEBP, and PDF. The default value is PNG.

For Screenshot Type = Full Page Screenshots, the available options are: PNG, JPEG, and WEBP, suitable for static images. The default value is PNG.

For Screenshot Type = Scrolling screenshots, the available options are: GIF, WEBM, and MP4, each optimized for different playback and quality needs. The default value is WEBM.

PNG

Output Format

Optional

The format in which the screenshot (response content) will be delivered. The default value is JSON.

JSON

Browser Height

Optional

The viewport height in pixels for the browser render. The range is between 480 and 10,000. The default value is 867.

867

Browser Width

Optional

The viewport width in pixels for the browser render. The range is between 320 and 1920. The default value is 1680.

1680

Fresh

Optional

If True, take a fresh screenshot or render (or PDF). If False, get the version cached version within the app's storage. The default value is True.

False

Save As File

Optional

The option to save the screenshot as a file in the D3 system. The filename will be automatically generated as "screenshot_<url>_<createTimestamp>.<fileType>". Note: This setting applies only when the output format is "JSON". If the output format is "Image", the output data will always be saved as a file in the D3 system. The default value is True.

True

Addition Request Options

Optional

The place to input more request options that can affect the screenshot. For more information, please refer to Screenshot API Docs.

{ "destroy_screenshot": true, "lazy_load": true }

Output

Return Data

Indicates one of the possible command execution states: Successful, Partially Successful, or Failed.

The Partially Successful state only occurs when a command’s input accepts an array of items (e.g. an array of IP addresses) and one or more items within the array return an error from the API request.

The Failed state can be triggered by any of the following errors:

  • A connection issue with the integration

  • The API returned an error message

  • No response from the API

You can view more details about an error in the Error tab.

Return Data can be passed down directly to a subsequent command or used to create conditional tasks in playbooks.

SAMPLE DATA

CODE
Successful
Raw Data

The primary response data from the API request.

SAMPLE DATA

CODE
{
    "Results": [
        {
            "url": "apple.com",
            "fileId": "*****",
            "fileName": "screenshot_apple.com_*****.png",
            "md5": "*****",
            "sha1": "*****",
            "sha256": "*****"
        },
        {
            "screenshot": "https://storage.screenshotapi.net/*****.png",
            "url": "https://www.apple.com/ca/store?afid=*****|*****-*****&cid=aos-ca-kwGO-brand--slid---product-",
            "created_at": "2024-04-24T18:01:39.808Z",
            "is_fresh": true,
            "token": "<TOKEN>",
            "fresh": "true",
            "output": "json",
            "full_page": "true",
            "ttl": "2024-05-24T18:01:31.729Z",
            "fileId": "*****",
            "fileName": "screenshot_www.apple.com%2Fca%*****.png",
            "md5": "*****",
            "sha1": "*****",
            "sha256": "*****"
        }
    ],
    "D3Errors": []
}
Key Fields

Common cyber security indicators such as unique IDs, file hash values, CVE numbers, IP addresses, etc., will be extracted from Raw Data as Key Fields.
The system stores these key fields in the path $.[playbookTask].outputData. You can use these key-value pairs as data points for playbook task inputs.

SAMPLE DATA

CODE
{
    "ScreenshotURLs":[
        "https://storage.screenshotapi.net/*****.png"
    ],
    "FileIDs": [
        "*****"
    ],
    "FileNames": [
        "screenshot_www.apple.com%2Fca%*****.png"
    ]
}
Result

Provides a brief summary of outputs in an HTML formatted table.

SAMPLE DATA

Results

  • {'url': 'http://apple.com ', 'fileId': '***', 'fileName': 'screenshot_apple.*****.png', 'md5': '*****', 'sha1': '*****', 'sha256': '*****'}

  • {'screenshot': 'https://storage.screenshotapi.net/*****.png', 'url': 'https://www.apple.com/ca/store?afid=*****- ', 'created_at': '2024-04-24T18:01:39.808Z', 'is_fresh': True, 'token': '<TOKEN>', 'fresh': 'true', 'output': 'json', 'full_page': 'true', 'ttl': '2024-05-24T18:01:31.729Z', 'fileId': '110', 'fileName': 'screenshot_www.apple.com%2Fca%*****.png', 'md5': '*****', 'sha1': '*****', 'sha256': '*****'}

D3Errors

[]

Error Handling

If the Return Data is Partially Successful or Failed, an Error tab will appear in the Test Result window.

The error tab contains the details responded from D3 SOAR or third-party API calls, including Failure Indicator, Status Code, and Message. This can help you locate the root cause of a command failure.

Parts in Error

Description

Example

Failure Indicator

Indicates the command failure that happened at a specific input and/or API call.

Capture Webpage Screenshots failed.

Status Code

The response code issued by the third-party API server or the D3 SOAR system that can be used to locate the corresponding error category. For example, if the returned status code is 401, the selected connection is unauthorized to run the command. The user or system support would need to check the permission setting in the Screenshot API portal. Refer to the HTTP Status Code Registry for details.

Status Code: 400.

Message

The raw data or captured key error message from the integration API server about the API request failure.

Message: Your trial has expired. Please upgrade to continue using Screenshot API.

Error Sample Data

Capture Webpage Screenshots failed.

Status Code: 400.

Message: Your trial has expired. Please upgrade to continue using Screenshot API.

Test Connection

Allows you to perform a health check on an integration connection. You can schedule a periodic health check by selecting Connection Health Check when editing an integration connection.

Input

N/A

Output

Return Data

Indicates one of the possible command execution states: Successful or Failed.

The Failed state can be triggered by any of the following errors:

  • A connection issue with the integration

  • The API returned an error message

  • No response from the API

You can view more details about an error in the Error tab.

SAMPLE DATA

CODE
Successful

Error Handling

If the Return Data is Failed, an Error tab will appear in the Test Result window.

The error tab contains the details responded from D3 SOAR or third-party API calls, including Failure Indicator, Status Code, and Message. This can help you locate the root cause of a command failure.

Parts in Error

Description

Example

Failure Indicator

Indicates the command failure that happened at a specific input and/or API call.

Test Connection failed. Failed to check the connector.

Status Code

The response code issued by the third-party API server or the D3 SOAR system that can be used to locate the corresponding error category. For example, if the returned status code is 401, the selected connection is unauthorized to run the command. The user or system support would need to check the permission setting in the Screenshot API portal. Refer to the HTTP Status Code Registry for details.

Status Code: 400.

Message

The raw data or captured key error message from the integration API server about the API request failure.

Message: Your trial has expired. Please upgrade to continue using Screenshot API.

Error Sample Data

Test Connection failed. Failed to check the connector.

Status Code: 400.

Message: Your trial has expired. Please upgrade to continue using Screenshot API.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.