Free Support Forum -

Api services as a whole and their intended functionality


Hello, I had a few questions about your api services as a whole and their intended functionality:

1) I saw that you can create groupdocs users with api and was wondering is this the intended way to use the api? Should I create a groupdocs user for each of my users via the api that way they can use all your functions the way they were designed?

2) When I test my implementation of annotation for instance it says that I am annotating as anonymous user, is it best practices to create groupdocs user from api for each user?

3) It adds another level of complexity because I now i have to keep track of users credentials for not only my site but for your site as well? Is there a user guid or something that identifies them?

4) The storageApi has a function called Compress:
 * Compress
 * Compress
 * userId, string: User GUID (required)
 * fileId, string: File ID (required)
 * archiveType, string: Archive type (optional)
 * @return CompressResponse
public function Compress($userId, $fileId, $archiveType=null) {
This mentions the User GUID and the File ID. I'm using clientId for User GUID and for $fileId using the same exact GUID for the file that I use for annotate request and document viewing request. But when I use this function I am getting a response that the doc doesn't exist. How should I identify the fileId for this function?

5) What happens if I have user A who uploads document.docx into my site (which automatically sends to groupdocs) and then user B who uploads a file also called document.docx which gets uploaded into my site and then into my groupdocs. now there are two files in my groupdocs account with the same name? what happens here?

This message was posted using Email2Forum by ihor.mykhalevych1.



Thank you for your interest in GroupDocs. In your case you should create users only for Annotation functionality. To sign Annotation with some user name without GroupDocs authorization you should have or add user in your GroupDocs account and then you can auth the user via special parameters in the annotation URL. In details you should follow the following logic:
1. Get all users from GroupDocs account
2. Take user email, first name, last name (from user data which logged in your site)
3. Check if the user with the same email already exists in your GroupDocs account
4. If user exists - get its GUID
5. If user doesn’t exist - create it and get its GUID
6. Get all collaborators for the document
7. Check if the user already presented in the collaborators
8. If user already in - set its GUID to “uid” parameter in the Iframe URL
9. If not in the collaborators - add him to collaborators
10. Add user GUID to “uid” parameter in the iframe URL
11. Sign URL

After these steps you should have the URL like this: here?uid=&signature=
URL parameters:
uid – user GUID from GroupDocs
signature – will be added to the URL automatic by signing URL
Please check this sample for more info -

As for Compress() method – in the $fileId parameter you should use your file ID (not file GUID). To get file ID should follow the following logic:
1. Upload file by using “UploadWeb” to upload file from WEB or “Upload” to upload local file.
2. Get file ID from response object
Please check this sample to investigate this -

When you or somebody else upload file with the same name to the GroupDocs it will be overwritten.

Pease feel free to contact us if you have any issues, we will be glad to help you.



Thank you for your patience. We investigated your requests from the Live Chat and in case when you have file GUID and you want to get it’s ID you can use “GetDocumentMetadata” method from the “DocApi” class.

For how to use this method please check this code:
$signer = new GroupDocsRequestSigner($privateKey);
$apiClient = new APIClient($signer);
$docApi = new DocApi($apiClient);
$docInfo = $docApi->GetDocumentMetadata($clientId, $fileGuid);
$id = $docInfo->result->last_view->document->id;

As for keeping uploaded files with same name – sorry but at this time it can be done only by renaming uploaded files. Or upload them to the different folders. To do that you should set “path” parameter in the “Upload” method. For example from one user you can upload to the path “//” and for other user “//fileName”

If you will have more questions please feel free to contact us.