# \AttachmentsApi
All URIs are relative to *https://app.asana.com/api/1.0*
Method | HTTP request | Description
------------- | ------------- | -------------
[**create_attachment_for_task**](AttachmentsApi.md#create_attachment_for_task) | **post** /tasks/{task_gid}/attachments | Upload an attachment
[**delete_attachment**](AttachmentsApi.md#delete_attachment) | **delete** /attachments/{attachment_gid} | Delete an attachment
[**get_attachment**](AttachmentsApi.md#get_attachment) | **get** /attachments/{attachment_gid} | Get an attachment
[**get_attachments_for_task**](AttachmentsApi.md#get_attachments_for_task) | **get** /tasks/{task_gid}/attachments | Get attachments for a task
## create_attachment_for_task
> crate::models::InlineResponse200 create_attachment_for_task(task_gid, opt_pretty, opt_fields, limit, offset, file)
Upload an attachment
Upload an attachment. This method uploads an attachment to a task and returns the compact record for the created attachment object. It is not possible to attach files from third party services such as Dropbox, Box & Google Drive via the API. You must download the file content first and then upload it as any other attachment. The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**task_gid** | **String** | The task to operate on. | [required] |
**opt_pretty** | Option<**bool**> | Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. | |
**opt_fields** | Option<[**Vec<String>**](String.md)> | Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. | |
**limit** | Option<**i32**> | Results per page. The number of objects to return per page. The value must be between 1 and 100. | |
**offset** | Option<**String**> | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | |
**file** | Option<**std::path::PathBuf**> | | |
### Return type
[**crate::models::InlineResponse200**](inline_response_200.md)
### Authorization
[oauth2](../README.md#oauth2), [personalAccessToken](../README.md#personalAccessToken)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## delete_attachment
> crate::models::InlineResponse2001 delete_attachment(attachment_gid, opt_pretty, opt_fields)
Delete an attachment
Deletes a specific, existing attachment. Returns an empty data record.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**attachment_gid** | **String** | Globally unique identifier for the attachment. | [required] |
**opt_pretty** | Option<**bool**> | Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. | |
**opt_fields** | Option<[**Vec<String>**](String.md)> | Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. | |
### Return type
[**crate::models::InlineResponse2001**](inline_response_200_1.md)
### Authorization
[oauth2](../README.md#oauth2), [personalAccessToken](../README.md#personalAccessToken)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_attachment
> crate::models::InlineResponse200 get_attachment(attachment_gid, opt_pretty, opt_fields)
Get an attachment
Get the full record for a single attachment.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**attachment_gid** | **String** | Globally unique identifier for the attachment. | [required] |
**opt_pretty** | Option<**bool**> | Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. | |
**opt_fields** | Option<[**Vec<String>**](String.md)> | Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. | |
### Return type
[**crate::models::InlineResponse200**](inline_response_200.md)
### Authorization
[oauth2](../README.md#oauth2), [personalAccessToken](../README.md#personalAccessToken)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_attachments_for_task
> crate::models::InlineResponse2002 get_attachments_for_task(task_gid, opt_pretty, opt_fields, limit, offset)
Get attachments for a task
Returns the compact records for all attachments on the task.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**task_gid** | **String** | The task to operate on. | [required] |
**opt_pretty** | Option<**bool**> | Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. | |
**opt_fields** | Option<[**Vec<String>**](String.md)> | Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. | |
**limit** | Option<**i32**> | Results per page. The number of objects to return per page. The value must be between 1 and 100. | |
**offset** | Option<**String**> | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | |
### Return type
[**crate::models::InlineResponse2002**](inline_response_200_2.md)
### Authorization
[oauth2](../README.md#oauth2), [personalAccessToken](../README.md#personalAccessToken)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)