This REST API allows to obtain basic information about the document and it’s properties.
It returns InfoResult data structure, which contains the list of properties:
Document file format
File extension
File size
Pages count
Resource
The following GroupDocs.Viewer Cloud REST API resource has been used to get document information.
cURL example
* First get JSON Web Token
* Please get your Client Id and Client Secret from <https://dashboard.groupdocs.cloud/applications>. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "https://api.groupdocs.cloud/connect/token"\
-X POST \
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx"\
-H "Content-Type: application/x-www-form-urlencoded"\
-H "Accept: application/json"* cURL example to get document information
curl -v "https://api.groupdocs.cloud/v2.0/comparison/info"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer <jwt token>"-d "{
'FilePath': 'source_files/word/source.docx'
}"
{"format":"Microsoft Word Document","extension":".docx","size":23059,"pageCount":1}
SDK example
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.
// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samplesstringMyClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudstringMyClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyClientId,MyClientSecret);varapiInstance=newInfoApi(configuration);varfileInfo=newFileInfo{FilePath="source_files/word/source.docx"};varrequest=newGetDocumentInfoRequest(fileInfo);varresponse=apiInstance.GetDocumentInfo(request);
// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples
StringMyClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
StringMyClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyClientId,MyClientSecret);InfoApiapiInstance=newInfoApi(configuration);FileInfofileInfo=newFileInfo();fileInfo.setFilePath("source_files/word/source.docx");GetDocumentInfoRequestrequest=newGetDocumentInfoRequest(fileInfo);InfoResultresponse=apiInstance.getDocumentInfo(request);
// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-php-samples
useGroupDocs\Comparison\Model;useGroupDocs\Comparison\Model\Requests;$ClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$ClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Comparison\Configuration();$configuration->setAppSid($ClientId);$configuration->setAppKey($ClientSecret);$apiInstance# new GroupDocs\Comparison\InfoApi($configuration);
$fileInfo=newModel\FileInfo();$fileInfo->setFilePath("source_files/word/source.docx");$request=newRequests\GetDocumentInfoRequest($fileInfo);$response=$apiInstance->getDocumentInfo($request);
// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples
global.comparison_cloud=require("groupdocs-comparison-cloud");global.clientId="XXXX-XXXX-XXXX-XXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
global.clientSecret="XXXXXXXXXXXXXXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
global.infoApi=comparison_cloud.InfoApi.fromKeys(clientId,clientSecret);try{letfileInfo=newcomparison_cloud.FileInfo();fileInfo.filePath="source_files/word/source.docx";letrequest=newcomparison_cloud.GetDocumentInfoRequest(fileInfo);letresponse=awaitinfoApi.getDocumentInfo(request);console.log("GetDocumentInformation completed: "+response.pageCount);}catch(error){console.log(error.message);}
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samplesimportgroupdocs_comparison_cloudclient_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudclient_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudinfoApi=groupdocs_comparison_cloud.InfoApi.from_keys(client_id,client_secret)file_info=groupdocs_comparison_cloud.FileInfo()file_info.file_path="source_files/word/source.docx"request=groupdocs_comparison_cloud.GetDocumentInfoRequest(file_info)result=infoApi.get_document_info(request)
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-ruby-samplesrequire'groupdocs_comparison_cloud'$client_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud$client_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudinfoApi=GroupDocsComparisonCloud::InfoApi.from_keys($client_id,$client_secret)file_info=GroupDocsComparisonCloud::FileInfo.newfile_info.file_path="source_files/word/source.docx"request=GroupDocsComparisonCloud::GetDocumentInfoRequest.new(file_info)response=infoApi.get_document_info(request)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.