Before you can make any requests to GroupDocs Cloud API you need to get Client Id and Client Secret. That will be used to invoke the GroupDocs Cloud API.
GroupDocs.Viewer Cloud SDK is written in different languages, all you need to get started is adding our SDK to your project.
Make an API request
Use the Client Id and Client Secret from the API app client you created in step one and replace in the corresponding code. Below is an example demonstrating using Formats API to get all supported file formats in GroupDocs.Viewer Cloud.
Note
The GitHub repository for GroupDocs.Viewer Cloud has a complete set of examples, demonstrating our API capabilities.
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).varconfiguration=newConfiguration{AppSid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",AppKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"};varapiInstance=newViewerApi(configuration);try{varrequest=newGetSupportedFileFormatsRequest();// Get supported file formatsvarresponse=apiInstance.GetSupportedFileFormats(request);foreach(varformatinresponse.Formats){Debug.Print(format.ToString());}}catch(Exceptione){Debug.Print("Exception when calling ViewerApi.DeleteFontsCache: "+e.Message);}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
StringappSid="xxxx";StringappKey="xxx-xx";ViewerApiapiInstance=newViewerApi(appSid,appKey);try{FormatCollectionresponse=apiInstance.getSupportedFileFormats();if(response.getFormats().size()>0){for(Formatformat:response.getFormats()){System.out.println("Format: "+format.toString());}}System.out.println("Executed Successfully");}catch(ApiExceptione){System.err.println("Exception when calling ViewerApi");e.printStackTrace();}
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
$configuration=newGroupDocs\Viewer\Configuration();$configuration->setAppSid($sid);$configuration->setAppKey($key);$viewerApi=newGroupDocs\Viewer\ViewerApi($configuration);try{$request=newGroupDocs\Viewer\Model\Requests\GetSupportedFileFormatsRequest();$response=$viewerApi->getSupportedFileFormats($request);foreach($response->getFormats()as$key=>$format){echo$format->getFileFormat()." - ".$format->getExtension(),"\n";}}catch(Exception$e){echo"Something went wrong: ",$e->getMessage(),"\n";}
"use strict";exports.__esModule=true;// load the module
vargroupdocs_viewer_cloud_1=require("groupdocs-viewer-cloud");// get your appSid and appKey at https://dashboard.groupdocs.cloud (free registration is required).
varappSid="XXXX-XXXX-XXXXX";varappKey="XXXXXXXXXX";// construct ViewerApi
varviewerApi=groupdocs_viewer_cloud_1.ViewerApi.fromKeys(appSid,appKey);// retrieve supported file-formats
viewerApi.getSupportedFileFormats().then(function(result){console.log("Supported file-formats:");result.formats.forEach(function(format){console.log(format.fileFormat+" ("+format.extension+")");});})["catch"](function(error){console.log("Error: "+error.message);});
# Import moduleimportgroupdocs_viewer_cloud# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).app_sid="XXX-XXXXXXX-XXXX"app_key="XXXXXXXXXXXXX"# Create instance of the GroupDocs Viewer APIapi = groupdocs_viewer_cloud.ViewerApi.from_keys(app_sid, app_key)try:response=api.get_supported_file_formats()print('Response:')forformatinresponse.formats:print('{0} ({1})'.format(format.file_format,format.extension))exceptgroupdocs_viewer_cloud.ApiExceptionase:print('Exception while calling Viewer API: {0}'.format(e.message))
# Load the gemrequire'groupdocs_viewer_cloud'require'..\lib\groupdocs_viewer_cloud\api\viewer_api'# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).app_sid="XXX-XXXXXXX-XXXX"app_key="XXXXXXXXXXXXX"# Create instance of the API classapi=GroupDocsViewerCloud.from_keys(app_sid,app_key)# Retrieve supported file-formatsresponse=api.get_supported_file_formats# Print out supported file-formatsputs("Supported file-formats:")response.formats.eachdo|format|puts("#{format.file_format} (#{format.extension})")end
packageexamples.Supported_File_Formats;importcom.groupdocs.cloud.viewer.client.*;importcom.groupdocs.cloud.viewer.model.*;importcom.groupdocs.cloud.viewer.api.InfoApi;importexamples.Utils;publicclassViewer_Android_Get_Supported_Formats{publicstaticvoidmain(String[]args){InfoApiapiInstance=newInfoApi(Utils.AppSID,Utils.AppKey);try{FormatsResultresponse=apiInstance.getSupportedFileFormats();for(Formatformat:response.getFormats()){System.out.println(format.getFileFormat());}}catch(ApiExceptione){System.err.println("Exception while calling InfoApi:");e.printStackTrace();}}}
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.