Get Number of Pages in Object's Document

GET /node/api/objects/:object_id/docs/:doc_id/:format/pages

Returns the number of pages in object's document.

Request parameters

Path parameters

Parameter
Type
Description
doc_id
String required
The ID of a document to be processed.
format
String required
Either .png or .pdf. For the first option, the actual number of pages is returned. For the second one, the result is always equal to 1.
object_id
String required
The ID of an object whose document should be processed.

Response description

Field
Type
Description
count
Integer
The number of pages in object's document.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
object_id=<...>
5
document_id=<...>
6
format=png
7
url=https://$saymon_hostname/node/api/objects/$object_id/docs/$document_id/$format/pages
8
9
curl -X GET $url -u $login:$password
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let objectId = <...>
5
let documentId = <...>
6
let format = "png";
7
let path = "/node/api/objects/" + objectId + "/docs/" +
8
documentId + "/" + format + "/pages";
9
let auth = "Basic " + btoa(login + ":" + password);
10
11
let headers = new Headers();
12
headers.append("Authorization", auth);
13
14
let requestOptions = {
15
method: "GET",
16
headers: headers
17
};
18
19
fetch(saymonHostname + path, requestOptions)
20
.then(response => response.text())
21
.then(result => console.log(result))
22
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let objectId = <...>
7
let documentId = <...>
8
let format = "png";
9
let path = "/node/api/objects/" + objectId + "/docs/" +
10
documentId + "/" + format + "/pages";
11
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
12
13
let options = {
14
"method": "GET",
15
"hostname": saymonHostname,
16
"headers": {
17
"Authorization": auth
18
},
19
"path": path
20
};
21
22
let req = http.request(options, function (res) {
23
let chunks = [];
24
25
res.on("data", function (chunk) {
26
chunks.push(chunk);
27
});
28
29
res.on("end", function (chunk) {
30
let body = Buffer.concat(chunks);
31
console.log(body.toString());
32
});
33
34
res.on("error", function (error) {
35
console.error(error);
36
});
37
});
38
39
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
object_id = <...>
7
document_id = <...>
8
_format = "png"
9
url = "https://" + saymon_hostname + "/node/api/objects/" + \
10
object_id + "/docs/" + document_id + "/" + _format + "/pages"
11
12
response = requests.request("GET", url, auth=(login, password))
13
print(response.text)
Copied!

Response description

1
{
2
"count": 24
3
}
Copied!
Last modified 1yr ago