Get a free preview
curl --request GET \
--url https://store.salesive.com/api/v1/digital-products/{id}/previewimport requests
url = "https://store.salesive.com/api/v1/digital-products/{id}/preview"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://store.salesive.com/api/v1/digital-products/{id}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/digital-products/{id}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/digital-products/{id}/preview"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://store.salesive.com/api/v1/digital-products/{id}/preview")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/digital-products/{id}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"status": 404,
"success": false,
"message": "The seller has not enabled a preview for this book",
"code": "disabled",
"data": {}
}{
"status": 429,
"success": false,
"message": "Too many preview requests. Please try again in 4 minutes.",
"data": {}
}{
"status": 503,
"success": false,
"message": "Previews are busy right now. Please try again in a moment",
"code": "busy",
"data": {}
}Digital
Get a free preview
Return the first pages of a PDF book as an inline PDF.
GET
/
digital-products
/
{id}
/
preview
Get a free preview
curl --request GET \
--url https://store.salesive.com/api/v1/digital-products/{id}/previewimport requests
url = "https://store.salesive.com/api/v1/digital-products/{id}/preview"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://store.salesive.com/api/v1/digital-products/{id}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/digital-products/{id}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/digital-products/{id}/preview"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://store.salesive.com/api/v1/digital-products/{id}/preview")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/digital-products/{id}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"status": 404,
"success": false,
"message": "The seller has not enabled a preview for this book",
"code": "disabled",
"data": {}
}{
"status": 429,
"success": false,
"message": "Too many preview requests. Please try again in 4 minutes.",
"data": {}
}{
"status": 503,
"success": false,
"message": "Previews are busy right now. Please try again in a moment",
"code": "busy",
"data": {}
}Request
GET /digital-products/6702c1a4e1b3a40012cd2001/preview
x-shop-id: {{shopId}}
Headers
| Header | Type | Description |
|---|---|---|
x-shop-id | string | Identify the shop context. |
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The digital product id. |
Public, like
/products: no sign-in is needed. Show a “Read a sample” button only when the item’s preview.available is true (see List products).What the preview contains
- The first N pages of the book, where N is the seller’s setting (default 3, between 1 and 20) but never more than half of the book and at least one. A book of fewer than two pages has no preview.
- A footer on every page, for example
Preview: first 3 of 120 pages. - Only the chosen pages: the rest of the book is not hidden inside the file, it is simply not there.
- PDFs only, up to 60 MB. The result is cached for an hour.
Successful response
200 with Content-Type: application/pdf, Content-Disposition: inline; filename="the-lagos-cookbook-preview.pdf" and Cache-Control: public, max-age=300. The body is the PDF, so open it in a new tab or an embedded viewer.
Error responses
Errors are JSON. A404 carries a code:
code | Meaning |
|---|---|
not_found | No such listed book in this store. |
no_file | The book has no file yet. |
not_pdf | Previews work for PDF files only. |
disabled | The seller switched the preview off for this book. |
unavailable | A preview could not be made: the file is encrypted, damaged, over 60 MB, or has fewer than two pages. |
429 when one visitor makes more than 40 preview requests in 5 minutes (Retry-After tells them when to try again), and 503 with code: "busy" and Retry-After: 5 when previews are busy.
{
"status": 404,
"success": false,
"message": "The seller has not enabled a preview for this book",
"code": "disabled",
"data": {}
}
Headers
Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.
Path Parameters
The digital product id.
Response
The preview PDF (Content-Disposition: inline, Cache-Control: public, max-age=300).
The response is of type file.
Was this page helpful?

