# 56. Enviar fotos

Fazer upload de uma foto via S3 contém 2 etapas:

1. **Solicitar o link pré-assinado para o upload direto posterior.**&#x20;

Como entrada:&#x20;

* fileExtention - jpeg OU jpg OU png,&#x20;
* farmUuid - uuid da fazenda,
* fieldUuid - uuid do campo,
* noteUuid - uuid da nota para o link direto da foto enviada,
* commentUuid - uuid do comentário para o link direto da foto enviada (opcional).&#x20;

Como saída:

* uuid - o uuid esperado após o upload e o processamento,
* farmUuid - o mesmo que a entrada,
* fieldUuid - o mesmo que a entrada,
* noteUuid - o mesmo que a entrada,
* commentUuid - o mesmo que a entrada (se existir),
* s3Url - a URL usada para enviar a foto,
* s3Fields - atributos a serem passados no formulário de upload da foto.

Os detalhes de como usar s3Url e s3Fields são descritos na segunda etapa.&#x20;

Os atributos são válidos por apenas 60 minutos para enviar a foto.

{% code overflow="wrap" lineNumbers="true" %}

```graphql
mutation generatePresignedPostPhotoData {
  generatePresignedPostPhotoData(input:{
    farmUuid: "89196056-61e5-4bce-b676-d488d611a829" 
    fieldUuid: "586a2ef2-03e4-4715-846c-07a2f0cb3016"
    noteUuid: "4a94da1c-f655-4f17-961a-4b0323e5129c"
    fileExtention: jpeg
    
  } ) {
    uuid
    noteUuid
    fieldUuid
    farmUuid
    s3Url
    s3Fields
  }
}
```

{% endcode %}

2. **Enviar uma foto local para s3Url com atributos de formulário predefinidos de s3Fields.**

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl --location --request POST '<s3Url>' \
--form 'key="<value_in_s3Fields>"' \
--form 'AWSAccessKeyId="<value_in_s3Fields>"' \
--form 'x-amz-security-token="<value_in_s3Fields>"' \
--form 'policy="<value_in_s3Fields>"' \
--form 'signature="<value_in_s3Fields>"' \
--form 'file=@"<local_file_path>"'
```

{% endcode %}

Notificações sobre o processamento serão entregues via o mecanismo de assinatura descrito em GraphQL -> Samples -> [1. Assinatura: Obter eventos](/geopard-tutorials/pt-br/docs-da-api/visao-geral-das-solicitacoes-da-api-do-geopard/1.-assinatura-obter-eventos.md).

{% hint style="info" %}
Use ‘Accept-Encoding’:’gzip, deflate, br’.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/pt-br/docs-da-api/visao-geral-das-solicitacoes-da-api-do-geopard/56.-enviar-fotos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
