Document Info
Purpose
To get the details of a particular PDF.
HTTP Request URL
https://{api.office-integrator_domain}/pdfeditor/officeapi/v1/pdf/<document_id>?apikey=<apikey>
Request Parameters
Parameter | Value | Description |
Mandatory Parameters | ||
apikey | 423s***** | Uniquely identifies the web application in which the PDF editor is integrated. |
document_id | String | Unique id of the document. |
Sample Request
Copiedhttps://api.office-integrator.com/pdfeditor/officeapi/v1/pdf/1349?apikey=423s*****
Copiedimport * as SDK from "@zoho-corp/office-integrator-sdk";
class GetPdfDocumentDetail {
static async execute() {
//Initializing SDK once is enough. Calling here since code sample will be tested standalone.
//You can place SDK initializer code in you application and call once while your application start-up.
await this.initializeSdk();
try {
var sdkOperations = new SDK.V1.V1Operations();
var editPdfParameters = new SDK.V1.EditPdfParameters();
editPdfParameters.setUrl("https://demo.office-integrator.com/zdocs/EventForm.pdf");
var responseObject = await sdkOperations.editPdf(editPdfParameters);
var sessionObject = responseObject.object;
if( sessionObject instanceof SDK.V1.CreateDocumentResponse ) {
var documentId = sessionObject.getDocumentId();
console.log("\nPDF session created to demonstrate get document details api. Created session ID - ", documentId);
var responseObject = await sdkOperations.getPdfDocumentInfo(documentId);
if(responseObject != null) {
//Get the status code from response
console.log("\nStatus Code: " + responseObject.statusCode);
//Get the api response object from responseObject
let documentMetaObj = responseObject.object;
if(documentMetaObj != null){
//TODO: Need to fix object type issue
if(documentMetaObj instanceof SDK.V1.DocumentMeta ){
console.log("\nDocument ID - " + documentMetaObj.getDocumentId());
console.log("\nSession Expires On - " + documentMetaObj.getExpiresOn());
console.log("\nSession Expires On MS - " + documentMetaObj.getExpiresOnMs());
console.log("\nDocument Name - " + documentMetaObj.getDocumentName());
console.log("\nDocument Type - " + documentMetaObj.getDocumentType());
console.log("\nDocument Created Time - " + documentMetaObj.getCreatedTime());
console.log("\nDocument Created Time MS - " + documentMetaObj.getCreatedTimeMs());
} else if (documentMetaObj instanceof SDK.V1.InvalidConfigurationException) {
console.log("\nInvalid configuration exception. Exception json - ", documentMetaObj);
} else {
console.log("\nRequest not completed successfullly");
}
}
}
}
} catch (error) {
console.log("\nException while running sample code", error);
}
}
//Include office-integrator-sdk package in your package json and the execute this code.
static async initializeSdk() {
// Refer this help page for api end point domain details - https://www.zoho.com/officeintegrator/api/v1/getting-started.html
let environment = await new SDK.DataCenter.Production("https://api.office-integrator.com");
let auth = new SDK.AuthBuilder()
.addParam("apikey", "2ae438cf8644886***********") //Update this apikey with your own apikey signed up in office integrator service
.authenticationSchema(await new SDK.V1.Authentication().getTokenFlow())
.build();
let tokens = [ auth ];
//Sdk application log configuration
let logger = new SDK.LogBuilder()
.level(SDK.Levels.INFO)
//.filePath("<file absolute path where logs would be written>") //No I18N
.build();
let initialize = await new SDK.InitializeBuilder();
await initialize.environment(environment).tokens(tokens).logger(logger).initialize();
console.log("SDK initialized successfully.");
}
}
GetPdfDocumentDetail.execute();
Sample Response
Copied{
"document_name": "New Document.pdf",
"created_time": "2025-03-21T12:55:00Z",
"collaborators_count": 1,
"active_sessions_count": 1,
"created_time_ms": 1742561700047,
"expires_on_ms": 1742583300047,
"expires_on": "2025-03-21T18:55:00Z",
"document_id": "1349",
"document_type": "native"
}