Screenshot API GET & POST Methods

How should I use the GET or POST REST API verbs?

If you want to create a screenshot of a single website, you should use the GET request method. This method is ideal for capturing a single webpage, as it is easy to use and requires minimal configuration.

On the other hand, if you need to capture a large number of screenshots, such as entire websites, sitemaps, domains, or lists of URLs, you should use the POST request method. This method is more complex than the GET method, but it is more flexible and can handle larger volumes of requests.

To help you decide which method to use, consider the following:

  • GET requests are easier to use and require less configuration, but they are limited to capturing single webpages.
  • POST requests are more complex, but they can handle larger volumes of requests, including entire websites, sitemaps, domains, and lists of URLs.

Visit our screenshot patterns page for examples of how to use the GET and POST methods to capture screenshots using Add Screenshots.

What are the GET and POST parameters / options?

Both GET and POST requests accept parameters to customize the screenshot such as the quality, format, full page and more.

GET requests will accept parameters using the query string as shown below:

// Line breaks added for readability GET https://api.addscreenshots.com/screenshots
?apikey=
YOUR_API_KEY
&quality=80
&format=jpeg
&fullpage=true
&url=https://www.youtube.com

POST requests will accept parameters using the query string and/or the JSON (Content-Type: application/json) body as shown below:

POST https://api.addscreenshots.com/screenshots?apikey= YOUR_API_KEY&quality=80
{
  "url": "https://www.youtube.com",
  "format": "jpeg",
  "fullpage": true
}

Notice that &quality=80 was specified in the query string however it could have been added to the body such as "quality": 80.

What is the HTTP GET method?

The GET method is ideal for simple, single website requests that can be kicked off using your browser's address bar. Given a URL with optional settings, the GET request will return a screenshot image while the user wait.

If a high-resolution, full page website takes 10 sec to load in a browser; then the user will typically have to wait for at least 10 sec for Add Screenshots to load the webpage, take the screenshot and send the image back to the user's browser.

What is the advantage of using the HTTP GET method?

GET methods use a real-time request-response approach, without delays, queuing or polling.

The screenshot will be displayed as soon as it is ready, making it an ideal solution for hot-linking to websites.

Large scale, concurrent/simultaneous screenshots are easily handled by Add Screenshot's cloud native architecture for optimal performance and reliability.

For additional performance gains, consider using screenshot caching.

What is the disadvantage of using the HTTP GET method?

The GET method is not ideal for taking screenshots of an entire website / domain with many web pages since the browser is likely to time-out waiting for all of the screenshots to process.

The GET method is also constrained to a maximum URL length of around 2048 characters. Therefore, if you have a large collection of website URLs to take screenshots of then the POST method would be better.

What is the HTTP POST method?

The POST method is ideal for turning a large volume of URLs into screenshots that are persisted in your own cloud storage such as Amazon S3 Buckets and Azure Blobs.

What is the advantage of using the HTTP POST method?

POST methods make it easy to send a large list of URLs or sitemaps with a quick response time. This is because the screenshots will be processed in the background without the need to wait around for it to complete.

POST requests that contains multiple URLs must include a storage information such as an Email Address, Amazon S3 Bucket, Azure Blob Shared Access Token or more.

Since POST requests are processed in the background, many simultaneous workers can take screenshots of an entire websites with many pages very quickly.

Taking a screenshot of a single website using a GET method may take 20 sec however Add Screenshots can take 1,000 screenshots of a website within 20 sec too, which includes uploading the images to a cloud repository and optimizing the images with compression. Please note that performance may vary based on multiple criteria such as the country/location of the website and cloud repository, the number of websites, the speed of the website, the size of the screenshots (e.g. partial vs full page), the throughput of the cloud storage drive and more.

What is the disadvantage of using the HTTP POST method?

POST lacks the real-time screenshot response provided by the GET method since the web request may timeout after a few minutes required to capture and download large sets of screenshots.