Session Details

Purpose 

To get the details of a particular PDF session.

HTTP Request URL

https://{api.office-integrator_domain}/pdfeditor/officeapi/v1/sessions/<session_id>?apikey=<apikey>

Request Parameters

ParameterValueDescription
Mandatory Parameters
apikeyStringUniquely identifies the web application in which the PDF editor is integrated.
session_idStringUnique user session id of the document.

Sample Request

Copiedhttps://api.office-integrator.com/pdfeditor/officeapi/v1/sessions/d26aa7b8029b5rf8d34c7dd00139392357d12ffcb21c1?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", "2ae438cf864488657cc********") //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{
    "user_info": {
        "user_id": "3001",
        "display_name": "Rose"
    },
    "status": "active",
    "info": {
        "created_time": "2025-03-21T12:55:04Z",
        "created_time_ms": 1742561704066,
        "expires_on_ms": 1742583300047,
        "session_delete_url": "https://api.office-integrator.com/pdfeditor/officeapi/v1/sessions/533e80dcb22b9e5ecfbd051e1015fc81012d62e73a985a95e3d74b9109abcda47333653538970dd6d02d0c248afdaf1850bab02e00b98e20ca7194a230137168db7bb4187e722154352f0e8e33b3d191460889af842f1bea8755d5f5b0c58664",
        "expires_on": "2025-03-21T18:55:00Z",
        "session_url": "https://api.office-integrator.com/pdfeditor/officeapi/v1/pdf/533e80dcb22b9e5ecfbd051e1015fc81012d62e73a985a95e3d74b9109abcda47333653538970dd6d02d0c248afdaf1850bab02e00b98e20ca7194a230137168db7bb4187e722154352f0e8e33b3d191460889af842f1bea8755d5f5b0c58664/edit",
        "document_id": "a07ed266-b33f-4cc3-8c03-eaf697bb3226"
    }
}