简体   繁体   English

在RingCentral Glip中是否有用于共享附件的API?

[英]Is there an API for sharing an attachment in RingCentral Glip?

I want to build an app that can monitor one Glip team for posts including screenshots and then post that message to another Glip team. 我想构建一个可以监视一个Glip团队的帖子(包括屏幕截图),然后将该消息发布到另一个Glip团队的应用。 I can read a post, download an attachment and repost / upload it, but is there a way to simply share an existing attachment without reposting it. 我可以阅读帖子,下载附件并重新发布/上传,但是有一种方法可以简单地共享现有附件而无需重新发布。 This can be done in the app UI but I didn't see a share API in the Glip API Reference. 可以在应用程序用户界面中完成此操作,但在Glip API参考中没有看到共享API。

Here's the Glip API Reference which includes endpoints for creating, reading, updating and deleting posts but not sharing: 这是Glip API参考,其中包括用于创建,阅读,更新和删除帖子但不共享的端点:

The icon for sharing is the 6th from the left in the app screenshot below. 共享的图标在下面的应用程序屏幕截图的左侧第6位。

RingCentral Glip按钮

Is there a way to do this in Glip without downloading and re-uploading the file? 是否可以在Glip中执行此操作而无需下载并重新上传文件?

To share an attachment via the Glip API, create a new post with an existing attachment. 要通过Glip API共享附件,请使用现有附件创建新帖子。

Create Post API 创建帖子API

The Create Post API takes an optional attachments array which references existing attachments. Create Post API采用可选的attachments数组,该数组引用现有附件。 Both the id and type properties are required. idtype属性都是必需的。 Both properties are present in the post API response. 这两个属性都存在于API后响应中。

POST /restapi/v1.0/glip/chats/{chatId}/posts

{
    "text": "Please check out this file",
    "attachments": [
        {
            "id":"123456789",
            "type":"File"
        }
    ]
}

Example Get Posts API 示例获取帖子API

The following is an example of a post showing the attachments array with the id and type properties. 以下是一个示例示例,显示了具有idtype属性的附件数组。 The attachment URL is an AWS Presigned Object URL as shown below. 附件URL是一个AWS Presigned Object URL,如下所示。

GET /restapi/v1.0/glip/chats/{chatId}/posts

{
    "records": [
        {
            "id": "11111111",
            "creatorId": "22222222",
            "creationTime": "2019-08-26T21:41:56.648Z",
            "lastModifiedTime": "2019-08-26T21:41:56.648Z",
            "type": "TextMessage",
            "chatId": "33333333",
            "mentions": [],
            "attachments": [
                {
                    "id": "123456789",
                    "name": "sharedfile.png",
                    "contentUri": "https://glip-vault-1.s3.amazonaws.com/web/customer_files/44444444/testimage.png?Expires=55555555&AWSAccessKeyId=myAccessKeyId&Signature=myAWSPresignedObjectUrlSignature",
                    "type": "File"
                }
            ],
            "text": "Check this out!"
        }
    },
    "navigation": {}
}

Sharing Permissions 共享权限

Attachments can only be shared by the original poster or within the same chat. 附件只能由原始发布者或在同一聊天中共享。 If a different user wants to share an attachment in a different team, it will be necessary to download and repost the file, generating a new attachment id. 如果其他用户希望在其他团队中共享附件,则必须下载并重新发布文件,以生成新的附件ID。

If a different user attempts to share an attachment in a different chat, a 403 Forbidden error will be encountered: 如果其他用户尝试在其他聊天中共享附件,则会遇到403 Forbidden错误:

403 Forbidden

{
    "errors": [
        {
            "errorCode": "PST-011",
            "message": "The requester must be attachment creator or attachment must belong to the requested chat."
        }
    ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM