#Upload file enpoint ?

1 messages · Page 1 of 1 (latest)

swift idol
#

Hey, I need to upload a file via REST API but I’m not sure what the endpoint should be. Any help?

#

Upload file enpoint

#

Upload file enpoint ?

fading loom
swift idol
#

🚀 thank youu

distant heart
#

Hi @fading loom, I've read the github thread but can't seem to find an answer there. The last entry from Felix mentioned that the only way is through GraphQL.

In short I'm trying to build an n8n workflow to pull attachment from emails and push it to Twenty (self-hosted). With GPT, I've set up a http request to domain.com/graphql but got this response.

I'm wondering if you have or have seen a step-by-step guide on how to push an attachment to Twenty?

fading loom
#

First you need to upload a file with UploadFilesFieldFile mutation from /metadata GraphQL endpoint with request being multipart data type (otherwise you won't be to upload a file), your Bearer token and following data:

  • operations: {"operationName":"UploadFilesFieldFile","variables":{"file":null,"fieldMetadataId":"e870fa90-15e3-4534-8070-4cb05ce8dfde"},"query":"mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) {\n uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) {\n id\n path\n size\n createdAt\n url\n __typename}}"}
  • map: {"1":["variables.file"]}
  • 1: (file of your choice)
#

Then, once file is uploaded properly, you have to make it as an attachment using CreateOneAttachment mutation located at /graphql GraphQL endpoint with GraphQL type and following data:

  • operations: mutation CreateOneAttachment($input: AttachmentCreateInput!) { createAttachment(data: $input) { __typename }}
  • variables: {"input": {"name": "cat.jpg","targetPersonId": "20202020-b225-4b3d-a89c-7f6c30df998a","file": [{"fileId": "9f3c0b7d-3985-4c5e-bfed-064e515d65f1","label": "cat.jpg"}], "id": "0d289b1a-6f98-48bf-b772-05d4abc70310"}}
fading loom