docs.AttachmentsApi.md Maven / Gradle / Ivy
# AttachmentsApi
All URIs are relative to *https://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**v1StreamSidAttachmentCreatePost**](AttachmentsApi.md#v1StreamSidAttachmentCreatePost) | **POST** /v1/stream/{sid}/attachment/create | Upload an attachment.
[**v1StreamSidAttachmentGet**](AttachmentsApi.md#v1StreamSidAttachmentGet) | **GET** /v1/stream/{sid}/attachment | Download an attachment.
# **v1StreamSidAttachmentCreatePost**
> AttachmentInfo v1StreamSidAttachmentCreatePost(sid, sessionToken, keyManagerToken, file)
Upload an attachment.
Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned.
### Example
```java
// Import classes:
//import org.symphonyoss.symphony.agent.invoker.ApiException;
//import org.symphonyoss.symphony.agent.api.AttachmentsApi;
AttachmentsApi apiInstance = new AttachmentsApi();
String sid = "sid_example"; // String | Stream ID
String sessionToken = "sessionToken_example"; // String | Session authentication token.
String keyManagerToken = "keyManagerToken_example"; // String | Key Manager authentication token.
File file = new File("/path/to/file.txt"); // File | The attachment body.
try {
AttachmentInfo result = apiInstance.v1StreamSidAttachmentCreatePost(sid, sessionToken, keyManagerToken, file);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AttachmentsApi#v1StreamSidAttachmentCreatePost");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**sid** | **String**| Stream ID |
**sessionToken** | **String**| Session authentication token. |
**keyManagerToken** | **String**| Key Manager authentication token. |
**file** | **File**| The attachment body. |
### Return type
[**AttachmentInfo**](AttachmentInfo.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
# **v1StreamSidAttachmentGet**
> byte[] v1StreamSidAttachmentGet(sid, fileId, messageId, sessionToken, keyManagerToken)
Download an attachment.
Downloads the attachment body by the attachment ID, stream ID, and message ID.
### Example
```java
// Import classes:
//import org.symphonyoss.symphony.agent.invoker.ApiException;
//import org.symphonyoss.symphony.agent.api.AttachmentsApi;
AttachmentsApi apiInstance = new AttachmentsApi();
String sid = "sid_example"; // String | Stream ID
String fileId = "fileId_example"; // String | The attachment ID (Base64-encoded)
String messageId = "messageId_example"; // String | The ID of the message containing the attachment
String sessionToken = "sessionToken_example"; // String | Session authentication token.
String keyManagerToken = "keyManagerToken_example"; // String | Key Manager authentication token.
try {
byte[] result = apiInstance.v1StreamSidAttachmentGet(sid, fileId, messageId, sessionToken, keyManagerToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AttachmentsApi#v1StreamSidAttachmentGet");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**sid** | **String**| Stream ID |
**fileId** | **String**| The attachment ID (Base64-encoded) |
**messageId** | **String**| The ID of the message containing the attachment |
**sessionToken** | **String**| Session authentication token. |
**keyManagerToken** | **String**| Key Manager authentication token. |
### Return type
**byte[]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/octet-stream