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
Pages count, size and visibility
Text coordinates
Attachments count and names
other properties, by document type
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 informationcurl -v "https://api.groupdocs.cloud/v2.0/viewer/info"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer <jwt token>"-d "{
'FileInfo': {
'FilePath': 'SampleFiles/sample.docx'
},
'ViewFormat': 'JPG'
}"
{"formatExtension":".docx","format":"Microsoft Word Open XML Document","pages":[{"number":1,"width":595,"height":841,"visible":true,"lines":[]},{"number":2,"width":595,"height":841,"visible":true,"lines":[]},{"number":3,"width":595,"height":841,"visible":true,"lines":[]}],"attachments":[],"archiveViewInfo":null,"cadViewInfo":null,"projectManagementViewInfo":null,"outlookViewInfo":null,"pdfViewInfo":null}
SDK examples
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-viewer-cloud/groupdocs-viewer-cloud-dotnet-samplesstringMyClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudstringMyClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyClientId,MyClientSecret);varapiInstance=newInfoApi(configuration);varviewOptions=newViewOptions{FileInfo=newFileInfo{FilePath="SampleFiles/sample.docx"}};varresponse=apiInstance.GetInfo(newGetInfoRequest(viewOptions));
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php-samples
useGroupDocs\Viewer\Model;useGroupDocs\Viewer\Model\Requests;$ClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
$ClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Viewer\Configuration();$configuration->setAppSid($ClientId);$configuration->setAppKey($ClientSecret);$apiInstance# new GroupDocs\Viewer\InfoApi($configuration);
$viewOptions=newModel\ViewOptions();$fileInfo=newModel\FileInfo();$fileInfo->setFilePath("SampleFiles/sample.docx");$viewOptions->setFileInfo($fileInfo);$request=newRequests\GetInfoRequest($viewOptions);$response=$apiInstance->getInfo($request);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
stringMyClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
stringMyClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyClientId,MyClientSecret);InfoApiapiInstance=newInfoApi(configuration);FileInfofileInfo=newFileInfo();fileInfo.setFilePath("SampleFiles/sample.docx");ViewOptionsviewOptions=newViewOptions();viewOptions.setFileInfo(fileInfo);InfoResultresponse=apiInstance.getInfo(newGetInfoRequest(viewOptions));
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby-samplesrequire'groupdocs_viewer_cloud'$client_id="XXXX-XXXX-XXXX-XXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloud$client_secret="XXXXXXXXXXXXXXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudinfoApi=GroupDocsViewerCloud::InfoApi.from_keys($client_id,$client_secret)viewOptions=GroupDocsViewerCloud::ViewOptions.newviewOptions.file_info=GroupDocsViewerCloud::FileInfo.newviewOptions.file_info.file_path="SampleFiles/sample.docx"request=GroupDocsViewerCloud::GetInfoRequest.new(viewOptions)response=infoApi.get_info(request)
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-node-samples
global.viewer#require("groupdocs-viewer-cloud");global.clientId="XXXX-XXXX-XXXX-XXXX";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
global.clientSecret="XXXXXXXXXXXXXXXX";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
global.infoApi=viewer_cloud.InfoApi.fromKeys(clientId,clientSecret);letfileInfo=newviewer_cloud.FileInfo();fileInfo.filePath="SampleFiles/sample.docx";letviewOptions=newviewer_cloud.ViewOptions();viewOptions.fileInfo=fileInfo;letrequest=newviewer_cloud.GetInfoRequest(viewOptions);letresponse=awaitinfoApi.getInfo(request);
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-python-samplesimportgroupdocs_viewer_cloudclient_id="XXXX-XXXX-XXXX-XXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudclient_secret="XXXXXXXXXXXXXXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudinfoApi=groupdocs_viewer_cloud.InfoApi.from_keys(client_id,client_secret)view_options=groupdocs_viewer_cloud.ViewOptions()view_options.file_info=groupdocs_viewer_cloud.FileInfo()view_options.file_info.file_path="SampleFiles/sample.docx"request=groupdocs_viewer_cloud.GetInfoRequest(view_options)result=infoApi.get_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.