Amazon WorkDocs

2018/11/20 - Amazon WorkDocs - 1 new 2 updated api methods

Changes  With this release, clients can now use the GetResources API to fetch files and folders from the user's SharedWithMe collection. And also through this release, the existing DescribeActivities API has been enhanced to support additional filters such as the ActivityType and the ResourceId.

GetResources (new) Link ¶

Retrieves a collection of resources, including folders and documents. The only CollectionType supported is SHARED_WITH_ME .

See also: AWS API Documentation

Request Syntax

client.get_resources(
    AuthenticationToken='string',
    UserId='string',
    CollectionType='SHARED_WITH_ME',
    Limit=123,
    Marker='string'
)
type AuthenticationToken

string

param AuthenticationToken

The Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in accessing the API operation using AWS credentials.

type UserId

string

param UserId

The user ID for the resource collection. This is a required field for accessing the API operation using IAM credentials.

type CollectionType

string

param CollectionType

The collection type.

type Limit

integer

param Limit

The maximum number of resources to return.

type Marker

string

param Marker

The marker for the next set of results. This marker was received from a previous call.

rtype

dict

returns

Response Syntax

{
    'Folders': [
        {
            'Id': 'string',
            'Name': 'string',
            'CreatorId': 'string',
            'ParentFolderId': 'string',
            'CreatedTimestamp': datetime(2015, 1, 1),
            'ModifiedTimestamp': datetime(2015, 1, 1),
            'ResourceState': 'ACTIVE'|'RESTORING'|'RECYCLING'|'RECYCLED',
            'Signature': 'string',
            'Labels': [
                'string',
            ],
            'Size': 123,
            'LatestVersionSize': 123
        },
    ],
    'Documents': [
        {
            'Id': 'string',
            'CreatorId': 'string',
            'ParentFolderId': 'string',
            'CreatedTimestamp': datetime(2015, 1, 1),
            'ModifiedTimestamp': datetime(2015, 1, 1),
            'LatestVersionMetadata': {
                'Id': 'string',
                'Name': 'string',
                'ContentType': 'string',
                'Size': 123,
                'Signature': 'string',
                'Status': 'INITIALIZED'|'ACTIVE',
                'CreatedTimestamp': datetime(2015, 1, 1),
                'ModifiedTimestamp': datetime(2015, 1, 1),
                'ContentCreatedTimestamp': datetime(2015, 1, 1),
                'ContentModifiedTimestamp': datetime(2015, 1, 1),
                'CreatorId': 'string',
                'Thumbnail': {
                    'string': 'string'
                },
                'Source': {
                    'string': 'string'
                }
            },
            'ResourceState': 'ACTIVE'|'RESTORING'|'RECYCLING'|'RECYCLED',
            'Labels': [
                'string',
            ]
        },
    ],
    'Marker': 'string'
}

Response Structure

  • (dict) --

    • Folders (list) --

      The folders in the specified folder.

      • (dict) --

        Describes a folder.

        • Id (string) --

          The ID of the folder.

        • Name (string) --

          The name of the folder.

        • CreatorId (string) --

          The ID of the creator.

        • ParentFolderId (string) --

          The ID of the parent folder.

        • CreatedTimestamp (datetime) --

          The time when the folder was created.

        • ModifiedTimestamp (datetime) --

          The time when the folder was updated.

        • ResourceState (string) --

          The resource state of the folder.

        • Signature (string) --

          The unique identifier created from the subfolders and documents of the folder.

        • Labels (list) --

          List of labels on the folder.

          • (string) --

        • Size (integer) --

          The size of the folder metadata.

        • LatestVersionSize (integer) --

          The size of the latest version of the folder metadata.

    • Documents (list) --

      The documents in the specified collection.

      • (dict) --

        Describes the document.

        • Id (string) --

          The ID of the document.

        • CreatorId (string) --

          The ID of the creator.

        • ParentFolderId (string) --

          The ID of the parent folder.

        • CreatedTimestamp (datetime) --

          The time when the document was created.

        • ModifiedTimestamp (datetime) --

          The time when the document was updated.

        • LatestVersionMetadata (dict) --

          The latest version of the document.

          • Id (string) --

            The ID of the version.

          • Name (string) --

            The name of the version.

          • ContentType (string) --

            The content type of the document.

          • Size (integer) --

            The size of the document, in bytes.

          • Signature (string) --

            The signature of the document.

          • Status (string) --

            The status of the document.

          • CreatedTimestamp (datetime) --

            The timestamp when the document was first uploaded.

          • ModifiedTimestamp (datetime) --

            The timestamp when the document was last uploaded.

          • ContentCreatedTimestamp (datetime) --

            The timestamp when the content of the document was originally created.

          • ContentModifiedTimestamp (datetime) --

            The timestamp when the content of the document was modified.

          • CreatorId (string) --

            The ID of the creator.

          • Thumbnail (dict) --

            The thumbnail of the document.

            • (string) --

              • (string) --

          • Source (dict) --

            The source of the document.

            • (string) --

              • (string) --

        • ResourceState (string) --

          The resource state.

        • Labels (list) --

          List of labels on the document.

          • (string) --

    • Marker (string) --

      The marker to use when requesting the next set of results. If there are no additional results, the string is empty.

AddResourcePermissions (updated) Link ¶
Changes (response)
{'ShareResults': {'InviteePrincipalId': 'string'}}

Creates a set of permissions for the specified folder or document. The resource permissions are overwritten if the principals already have different permissions.

See also: AWS API Documentation

Request Syntax

client.add_resource_permissions(
    AuthenticationToken='string',
    ResourceId='string',
    Principals=[
        {
            'Id': 'string',
            'Type': 'USER'|'GROUP'|'INVITE'|'ANONYMOUS'|'ORGANIZATION',
            'Role': 'VIEWER'|'CONTRIBUTOR'|'OWNER'|'COOWNER'
        },
    ],
    NotificationOptions={
        'SendEmail': True|False,
        'EmailMessage': 'string'
    }
)
type AuthenticationToken

string

param AuthenticationToken

Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in accessing the API using AWS credentials.

type ResourceId

string

param ResourceId

[REQUIRED]

The ID of the resource.

type Principals

list

param Principals

[REQUIRED]

The users, groups, or organization being granted permission.

  • (dict) --

    Describes the recipient type and ID, if available.

    • Id (string) -- [REQUIRED]

      The ID of the recipient.

    • Type (string) -- [REQUIRED]

      The type of the recipient.

    • Role (string) -- [REQUIRED]

      The role of the recipient.

type NotificationOptions

dict

param NotificationOptions

The notification options.

  • SendEmail (boolean) --

    Boolean value to indicate an email notification should be sent to the receipients.

  • EmailMessage (string) --

    Text value to be included in the email body.

rtype

dict

returns

Response Syntax

{
    'ShareResults': [
        {
            'PrincipalId': 'string',
            'InviteePrincipalId': 'string',
            'Role': 'VIEWER'|'CONTRIBUTOR'|'OWNER'|'COOWNER',
            'Status': 'SUCCESS'|'FAILURE',
            'ShareId': 'string',
            'StatusMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ShareResults (list) --

      The share results.

      • (dict) --

        Describes the share results of a resource.

        • PrincipalId (string) --

          The ID of the principal.

        • InviteePrincipalId (string) --

          The ID of the invited user.

        • Role (string) --

          The role.

        • Status (string) --

          The status.

        • ShareId (string) --

          The ID of the resource that was shared.

        • StatusMessage (string) --

          The status message.

DescribeActivities (updated) Link ¶
Changes (request, response)
Request
{'ActivityTypes': 'string',
 'IncludeIndirectActivities': 'boolean',
 'ResourceId': 'string'}
Response
{'UserActivities': {'IsIndirectActivity': 'boolean',
                    'Type': {'DOCUMENT_VERSION_DOWNLOADED',
                             'DOCUMENT_VERSION_VIEWED'}}}

Describes the user activities in a specified time period.

See also: AWS API Documentation

Request Syntax

client.describe_activities(
    AuthenticationToken='string',
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1),
    OrganizationId='string',
    ActivityTypes='string',
    ResourceId='string',
    UserId='string',
    IncludeIndirectActivities=True|False,
    Limit=123,
    Marker='string'
)
type AuthenticationToken

string

param AuthenticationToken

Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in accessing the API using AWS credentials.

type StartTime

datetime

param StartTime

The timestamp that determines the starting time of the activities. The response includes the activities performed after the specified timestamp.

type EndTime

datetime

param EndTime

The timestamp that determines the end time of the activities. The response includes the activities performed before the specified timestamp.

type OrganizationId

string

param OrganizationId

The ID of the organization. This is a mandatory parameter when using administrative API (SigV4) requests.

type ActivityTypes

string

param ActivityTypes

Specifies which activity types to include in the response. If this field is left empty, all activity types are returned.

type ResourceId

string

param ResourceId

The document or folder ID for which to describe activity types.

type UserId

string

param UserId

The ID of the user who performed the action. The response includes activities pertaining to this user. This is an optional parameter and is only applicable for administrative API (SigV4) requests.

type IncludeIndirectActivities

boolean

param IncludeIndirectActivities

Includes indirect activities. An indirect activity results from a direct activity performed on a parent resource. For example, sharing a parent folder (the direct activity) shares all of the subfolders and documents within the parent folder (the indirect activity).

type Limit

integer

param Limit

The maximum number of items to return.

type Marker

string

param Marker

The marker for the next set of results.

rtype

dict

returns

Response Syntax

{
    'UserActivities': [
        {
            'Type': 'DOCUMENT_CHECKED_IN'|'DOCUMENT_CHECKED_OUT'|'DOCUMENT_RENAMED'|'DOCUMENT_VERSION_UPLOADED'|'DOCUMENT_VERSION_DELETED'|'DOCUMENT_VERSION_VIEWED'|'DOCUMENT_VERSION_DOWNLOADED'|'DOCUMENT_RECYCLED'|'DOCUMENT_RESTORED'|'DOCUMENT_REVERTED'|'DOCUMENT_SHARED'|'DOCUMENT_UNSHARED'|'DOCUMENT_SHARE_PERMISSION_CHANGED'|'DOCUMENT_SHAREABLE_LINK_CREATED'|'DOCUMENT_SHAREABLE_LINK_REMOVED'|'DOCUMENT_SHAREABLE_LINK_PERMISSION_CHANGED'|'DOCUMENT_MOVED'|'DOCUMENT_COMMENT_ADDED'|'DOCUMENT_COMMENT_DELETED'|'DOCUMENT_ANNOTATION_ADDED'|'DOCUMENT_ANNOTATION_DELETED'|'FOLDER_CREATED'|'FOLDER_DELETED'|'FOLDER_RENAMED'|'FOLDER_RECYCLED'|'FOLDER_RESTORED'|'FOLDER_SHARED'|'FOLDER_UNSHARED'|'FOLDER_SHARE_PERMISSION_CHANGED'|'FOLDER_SHAREABLE_LINK_CREATED'|'FOLDER_SHAREABLE_LINK_REMOVED'|'FOLDER_SHAREABLE_LINK_PERMISSION_CHANGED'|'FOLDER_MOVED',
            'TimeStamp': datetime(2015, 1, 1),
            'IsIndirectActivity': True|False,
            'OrganizationId': 'string',
            'Initiator': {
                'Id': 'string',
                'Username': 'string',
                'GivenName': 'string',
                'Surname': 'string',
                'EmailAddress': 'string'
            },
            'Participants': {
                'Users': [
                    {
                        'Id': 'string',
                        'Username': 'string',
                        'GivenName': 'string',
                        'Surname': 'string',
                        'EmailAddress': 'string'
                    },
                ],
                'Groups': [
                    {
                        'Id': 'string',
                        'Name': 'string'
                    },
                ]
            },
            'ResourceMetadata': {
                'Type': 'FOLDER'|'DOCUMENT',
                'Name': 'string',
                'OriginalName': 'string',
                'Id': 'string',
                'VersionId': 'string',
                'Owner': {
                    'Id': 'string',
                    'Username': 'string',
                    'GivenName': 'string',
                    'Surname': 'string',
                    'EmailAddress': 'string'
                },
                'ParentId': 'string'
            },
            'OriginalParent': {
                'Type': 'FOLDER'|'DOCUMENT',
                'Name': 'string',
                'OriginalName': 'string',
                'Id': 'string',
                'VersionId': 'string',
                'Owner': {
                    'Id': 'string',
                    'Username': 'string',
                    'GivenName': 'string',
                    'Surname': 'string',
                    'EmailAddress': 'string'
                },
                'ParentId': 'string'
            },
            'CommentMetadata': {
                'CommentId': 'string',
                'Contributor': {
                    'Id': 'string',
                    'Username': 'string',
                    'EmailAddress': 'string',
                    'GivenName': 'string',
                    'Surname': 'string',
                    'OrganizationId': 'string',
                    'RootFolderId': 'string',
                    'RecycleBinFolderId': 'string',
                    'Status': 'ACTIVE'|'INACTIVE'|'PENDING',
                    'Type': 'USER'|'ADMIN'|'POWERUSER'|'MINIMALUSER'|'WORKSPACESUSER',
                    'CreatedTimestamp': datetime(2015, 1, 1),
                    'ModifiedTimestamp': datetime(2015, 1, 1),
                    'TimeZoneId': 'string',
                    'Locale': 'en'|'fr'|'ko'|'de'|'es'|'ja'|'ru'|'zh_CN'|'zh_TW'|'pt_BR'|'default',
                    'Storage': {
                        'StorageUtilizedInBytes': 123,
                        'StorageRule': {
                            'StorageAllocatedInBytes': 123,
                            'StorageType': 'UNLIMITED'|'QUOTA'
                        }
                    }
                },
                'CreatedTimestamp': datetime(2015, 1, 1),
                'CommentStatus': 'DRAFT'|'PUBLISHED'|'DELETED',
                'RecipientId': 'string'
            }
        },
    ],
    'Marker': 'string'
}

Response Structure

  • (dict) --

    • UserActivities (list) --

      The list of activities for the specified user and time period.

      • (dict) --

        Describes the activity information.

        • Type (string) --

          The activity type.

        • TimeStamp (datetime) --

          The timestamp when the action was performed.

        • IsIndirectActivity (boolean) --

          Indicates whether an activity is indirect or direct. An indirect activity results from a direct activity performed on a parent resource. For example, sharing a parent folder (the direct activity) shares all of the subfolders and documents within the parent folder (the indirect activity).

        • OrganizationId (string) --

          The ID of the organization.

        • Initiator (dict) --

          The user who performed the action.

          • Id (string) --

            The ID of the user.

          • Username (string) --

            The name of the user.

          • GivenName (string) --

            The given name of the user before a rename operation.

          • Surname (string) --

            The surname of the user.

          • EmailAddress (string) --

            The email address of the user.

        • Participants (dict) --

          The list of users or groups impacted by this action. This is an optional field and is filled for the following sharing activities: DOCUMENT_SHARED, DOCUMENT_SHARED, DOCUMENT_UNSHARED, FOLDER_SHARED, FOLDER_UNSHARED.

          • Users (list) --

            The list of users.

            • (dict) --

              Describes the metadata of the user.

              • Id (string) --

                The ID of the user.

              • Username (string) --

                The name of the user.

              • GivenName (string) --

                The given name of the user before a rename operation.

              • Surname (string) --

                The surname of the user.

              • EmailAddress (string) --

                The email address of the user.

          • Groups (list) --

            The list of user groups.

            • (dict) --

              Describes the metadata of a user group.

              • Id (string) --

                The ID of the user group.

              • Name (string) --

                The name of the group.

        • ResourceMetadata (dict) --

          The metadata of the resource involved in the user action.

          • Type (string) --

            The type of resource.

          • Name (string) --

            The name of the resource.

          • OriginalName (string) --

            The original name of the resource before a rename operation.

          • Id (string) --

            The ID of the resource.

          • VersionId (string) --

            The version ID of the resource. This is an optional field and is filled for action on document version.

          • Owner (dict) --

            The owner of the resource.

            • Id (string) --

              The ID of the user.

            • Username (string) --

              The name of the user.

            • GivenName (string) --

              The given name of the user before a rename operation.

            • Surname (string) --

              The surname of the user.

            • EmailAddress (string) --

              The email address of the user.

          • ParentId (string) --

            The parent ID of the resource before a rename operation.

        • OriginalParent (dict) --

          The original parent of the resource. This is an optional field and is filled for move activities.

          • Type (string) --

            The type of resource.

          • Name (string) --

            The name of the resource.

          • OriginalName (string) --

            The original name of the resource before a rename operation.

          • Id (string) --

            The ID of the resource.

          • VersionId (string) --

            The version ID of the resource. This is an optional field and is filled for action on document version.

          • Owner (dict) --

            The owner of the resource.

            • Id (string) --

              The ID of the user.

            • Username (string) --

              The name of the user.

            • GivenName (string) --

              The given name of the user before a rename operation.

            • Surname (string) --

              The surname of the user.

            • EmailAddress (string) --

              The email address of the user.

          • ParentId (string) --

            The parent ID of the resource before a rename operation.

        • CommentMetadata (dict) --

          Metadata of the commenting activity. This is an optional field and is filled for commenting activities.

          • CommentId (string) --

            The ID of the comment.

          • Contributor (dict) --

            The user who made the comment.

            • Id (string) --

              The ID of the user.

            • Username (string) --

              The login name of the user.

            • EmailAddress (string) --

              The email address of the user.

            • GivenName (string) --

              The given name of the user.

            • Surname (string) --

              The surname of the user.

            • OrganizationId (string) --

              The ID of the organization.

            • RootFolderId (string) --

              The ID of the root folder.

            • RecycleBinFolderId (string) --

              The ID of the recycle bin folder.

            • Status (string) --

              The status of the user.

            • Type (string) --

              The type of user.

            • CreatedTimestamp (datetime) --

              The time when the user was created.

            • ModifiedTimestamp (datetime) --

              The time when the user was modified.

            • TimeZoneId (string) --

              The time zone ID of the user.

            • Locale (string) --

              The locale of the user.

            • Storage (dict) --

              The storage for the user.

              • StorageUtilizedInBytes (integer) --

                The amount of storage used, in bytes.

              • StorageRule (dict) --

                The storage for a user.

                • StorageAllocatedInBytes (integer) --

                  The amount of storage allocated, in bytes.

                • StorageType (string) --

                  The type of storage.

          • CreatedTimestamp (datetime) --

            The timestamp that the comment was created.

          • CommentStatus (string) --

            The status of the comment.

          • RecipientId (string) --

            The ID of the user being replied to.

    • Marker (string) --

      The marker for the next set of results.