GraphQL Mutation
mutation AddAttachment($input: AddAttachmentInput!) {
addAttachment(input: $input) {
id
filename
url
}
}
Multipart Request Structure
When making the request, you need to send multipart/form-data with three parts:
1. operations (text field):
{
"query": "mutation AddAttachment($input: AddAttachmentInput!) { addAttachment(input: $input) { id filename url }}",
"variables": {
"input": {
"file": null
}
}
}
2. map (text field):
{
"1": ["variables.input.file"]
}
3. 1 (file field):
<actual file data>
Example cURL Request
curl -X POST "https://graphql.au.staging.roubler.net/graphql" \
-H "Authorization: Bearer <access_token>" \
-H "X-Company-ID: <company_id>" \
-F 'operations={"query":"mutation AddAttachment($input: AddAttachmentInput!) { addAttachment(input: $input) { id filename url }}","variables":{"input":{"file":null}}}' \
-F 'map={"1":["variables.input.file"]}' \
-F '1=@/path/to/your/file.pdf'
Example Response
{
"data": {
"addAttachment": {
"id": "251779",
"filename": "file.pdf",
"url": "https://roubler-staging-storage.s3.ap-southeast-2.amazonaws.com/attachments/251779?AWSAccessKeyId=...&Expires=1717996392&Signature=..."
}
}
}