How To Capture Highly Customizable Website Snapshots
Screenshotlayer is a lightweight REST API built to deliver high-quality PNG, JPEG & GIF visual website snapshots through a simple and easy to use interface. We’re going to make use of that API to create a really powerful website snapshot app. Website snapshots, in Delphi, using the Screenshotlayer API The Screenshotlayer API is easy to integrate and works without requiring a queue. With the Screenshotlayer API, you can create a reliable web snapshot automation service. You can capture daily, weekly or monthly, and create an archive if you need. In this post, we will integrate Screenshotlayer API into a cross-platform desktop and mobile application using the Delphi FireMonkey Low-Code Wizard. What is the Screenshotlayer API? The Screenshotlayer API is a world-class RESTful web service to capture highly customizable snapshots of any website in seconds. Just give the website URL, and the web service returns you a screenshot of the website. It offers advanced options, for instance: Set preferred thumbnail dimensions and viewport Inject your CSS Specify a capturing delay Export to AWS S3, FTP and more How to use Screenshotlayer API? Capturing a snapshot using the Screenshotlayer API is simple. Each API request is based on the following URL and can be configured with different parameters. To make a simple request, you should pass the API access key and URL of the website that you want to take a screenshot of. Moreover, based on how you wish to configure your screenshot, you can choose from several optional parameters: fullpage – take a full height of the target website width – specify your preferred thumbnail width in pixels viewport – specify your preferred viewport dimensions in pixels format – screenshot output format secret_key – your secret key, an MD5 hash of the target & secret word (optional) delay – specify a delay before a screenshot is captured (in seconds) export – export snapshot via custom FTP path or using your AWS S3 user details Let’s see an example of a request Depending on your subscription plan, you can have more secure data streams and features or limits. For instance, higher-level subscription plan users can establish a secure connection. You can have maximum API performance, and the request limit is higher. URL Encryption – If you need a more secure connection, you can utilize the secret key for every API request. First, you need to specify the secret key on the dashboard. My secret key, of course, is the word “delphi”. Then we need to combine the URL and secret keyword into one string and create an MD5 hash out of the string. After that, you can give that value in the query. The Screenshotlayer API Features By default, screenshots are rendered based on the height of the selected viewport. You can alternatively request the full height of the target website with the parameters that we talked about above. CSS Injection – The Screenshotlayer API enables you to inject a custom CSS stylesheet into the target website by appending an existing CSS file URL to the API’s css_url parameter. TTL (Caching Time) – By default, website snapshots are cached for 30 days. Using the ttl parameter, you can specify a custom caching time lower than the default setting. Furthermore, you can have a fresh screenshot of the target website by using the force parameter, which refreshes the target website. How to export website snapshots to AWS S3 or […]
