|
| 1 | +# Attachment |
| 2 | + |
| 3 | +Method | HTTP request | Release Stage | |
| 4 | +------------- | ------------- | ----- | |
| 5 | +[**get**](#get) | **GET** /v1/attachments/{attachmentRid} | Stable | |
| 6 | +[**read**](#read) | **GET** /v1/attachments/{attachmentRid}/content | Stable | |
| 7 | +[**upload**](#upload) | **POST** /v1/attachments/upload | Stable | |
| 8 | + |
| 9 | +# **get** |
| 10 | +Get the metadata of an attachment. |
| 11 | + |
| 12 | +Third-party applications using this endpoint via OAuth2 must request the |
| 13 | +following operation scopes: `api:ontologies-read`. |
| 14 | + |
| 15 | + |
| 16 | +### Parameters |
| 17 | + |
| 18 | +Name | Type | Description | Notes | |
| 19 | +------------- | ------------- | ------------- | ------------- | |
| 20 | +**attachment_rid** | AttachmentRid | The RID of the attachment. | | |
| 21 | + |
| 22 | +### Return type |
| 23 | +**Attachment** |
| 24 | + |
| 25 | +### Example |
| 26 | + |
| 27 | +```python |
| 28 | +from foundry.v1 import FoundryClient |
| 29 | +import foundry |
| 30 | +from pprint import pprint |
| 31 | + |
| 32 | +foundry_client = FoundryClient( |
| 33 | + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" |
| 34 | +) |
| 35 | + |
| 36 | +# AttachmentRid | The RID of the attachment. |
| 37 | +attachment_rid = "ri.attachments.main.attachment.bb32154e-e043-4b00-9461-93136ca96b6f" |
| 38 | + |
| 39 | + |
| 40 | +try: |
| 41 | + api_response = foundry_client.ontologies.Attachment.get( |
| 42 | + attachment_rid, |
| 43 | + ) |
| 44 | + print("The get response:\n") |
| 45 | + pprint(api_response) |
| 46 | +except foundry.PalantirRPCException as e: |
| 47 | + print("HTTP error when calling Attachment.get: %s\n" % e) |
| 48 | + |
| 49 | +``` |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +### Authorization |
| 54 | + |
| 55 | +See [README](../../../README.md#authorization) |
| 56 | + |
| 57 | +### HTTP response details |
| 58 | +| Status Code | Type | Description | Content Type | |
| 59 | +|-------------|-------------|-------------|------------------| |
| 60 | +**200** | Attachment | Success response. | application/json | |
| 61 | + |
| 62 | +[[Back to top]](#) [[Back to API list]](../../../README.md#apis-v1-link) [[Back to Model list]](../../../README.md#models-v1-link) [[Back to README]](../../../README.md) |
| 63 | + |
| 64 | +# **read** |
| 65 | +Get the content of an attachment. |
| 66 | + |
| 67 | +Third-party applications using this endpoint via OAuth2 must request the |
| 68 | +following operation scopes: `api:ontologies-read`. |
| 69 | + |
| 70 | + |
| 71 | +### Parameters |
| 72 | + |
| 73 | +Name | Type | Description | Notes | |
| 74 | +------------- | ------------- | ------------- | ------------- | |
| 75 | +**attachment_rid** | AttachmentRid | The RID of the attachment. | | |
| 76 | + |
| 77 | +### Return type |
| 78 | +**bytes** |
| 79 | + |
| 80 | +### Example |
| 81 | + |
| 82 | +```python |
| 83 | +from foundry.v1 import FoundryClient |
| 84 | +import foundry |
| 85 | +from pprint import pprint |
| 86 | + |
| 87 | +foundry_client = FoundryClient( |
| 88 | + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" |
| 89 | +) |
| 90 | + |
| 91 | +# AttachmentRid | The RID of the attachment. |
| 92 | +attachment_rid = "ri.attachments.main.attachment.bb32154e-e043-4b00-9461-93136ca96b6f" |
| 93 | + |
| 94 | + |
| 95 | +try: |
| 96 | + api_response = foundry_client.ontologies.Attachment.read( |
| 97 | + attachment_rid, |
| 98 | + ) |
| 99 | + print("The read response:\n") |
| 100 | + pprint(api_response) |
| 101 | +except foundry.PalantirRPCException as e: |
| 102 | + print("HTTP error when calling Attachment.read: %s\n" % e) |
| 103 | + |
| 104 | +``` |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +### Authorization |
| 109 | + |
| 110 | +See [README](../../../README.md#authorization) |
| 111 | + |
| 112 | +### HTTP response details |
| 113 | +| Status Code | Type | Description | Content Type | |
| 114 | +|-------------|-------------|-------------|------------------| |
| 115 | +**200** | bytes | Success response. | */* | |
| 116 | + |
| 117 | +[[Back to top]](#) [[Back to API list]](../../../README.md#apis-v1-link) [[Back to Model list]](../../../README.md#models-v1-link) [[Back to README]](../../../README.md) |
| 118 | + |
| 119 | +# **upload** |
| 120 | +Upload an attachment to use in an action. Any attachment which has not been linked to an object via |
| 121 | +an action within one hour after upload will be removed. |
| 122 | +Previously mapped attachments which are not connected to any object anymore are also removed on |
| 123 | +a biweekly basis. |
| 124 | +The body of the request must contain the binary content of the file and the `Content-Type` header must be `application/octet-stream`. |
| 125 | + |
| 126 | +Third-party applications using this endpoint via OAuth2 must request the |
| 127 | +following operation scopes: `api:ontologies-write`. |
| 128 | + |
| 129 | + |
| 130 | +### Parameters |
| 131 | + |
| 132 | +Name | Type | Description | Notes | |
| 133 | +------------- | ------------- | ------------- | ------------- | |
| 134 | +**body** | bytes | Body of the request | | |
| 135 | +**content_length** | ContentLength | The size in bytes of the file content being uploaded. | | |
| 136 | +**content_type** | ContentType | The media type of the file being uploaded. | | |
| 137 | +**filename** | Filename | The name of the file being uploaded. | | |
| 138 | + |
| 139 | +### Return type |
| 140 | +**Attachment** |
| 141 | + |
| 142 | +### Example |
| 143 | + |
| 144 | +```python |
| 145 | +from foundry.v1 import FoundryClient |
| 146 | +import foundry |
| 147 | +from pprint import pprint |
| 148 | + |
| 149 | +foundry_client = FoundryClient( |
| 150 | + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" |
| 151 | +) |
| 152 | + |
| 153 | +# bytes | Body of the request |
| 154 | +body = None |
| 155 | +# ContentLength | The size in bytes of the file content being uploaded. |
| 156 | +content_length = None |
| 157 | +# ContentType | The media type of the file being uploaded. |
| 158 | +content_type = None |
| 159 | +# Filename | The name of the file being uploaded. |
| 160 | +filename = "My Image.jpeg" |
| 161 | + |
| 162 | + |
| 163 | +try: |
| 164 | + api_response = foundry_client.ontologies.Attachment.upload( |
| 165 | + body, |
| 166 | + content_length=content_length, |
| 167 | + content_type=content_type, |
| 168 | + filename=filename, |
| 169 | + ) |
| 170 | + print("The upload response:\n") |
| 171 | + pprint(api_response) |
| 172 | +except foundry.PalantirRPCException as e: |
| 173 | + print("HTTP error when calling Attachment.upload: %s\n" % e) |
| 174 | + |
| 175 | +``` |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | +### Authorization |
| 180 | + |
| 181 | +See [README](../../../README.md#authorization) |
| 182 | + |
| 183 | +### HTTP response details |
| 184 | +| Status Code | Type | Description | Content Type | |
| 185 | +|-------------|-------------|-------------|------------------| |
| 186 | +**200** | Attachment | Success response. | application/json | |
| 187 | + |
| 188 | +[[Back to top]](#) [[Back to API list]](../../../README.md#apis-v1-link) [[Back to Model list]](../../../README.md#models-v1-link) [[Back to README]](../../../README.md) |
| 189 | + |
0 commit comments