To Upload a file you will be uploading directly to Amazon's S3 server (the backbone of Folio). To do this you will first need to make the request detailed below which will will contain all of the keys and information you will pass along to upload the attachment.
|
Request |
Response |
|
mutation { |
{ |
With this response you can now upload a file into Folio.
The curl request you make to upload a file is shown below, with the text in {} to be replaced with the corresponding field from the response.
The UUID at the end of the response will be used later to identify the attachment after you have uploaded it.
curl -v -F 'key={key}' -F "acl={acl}" -F "policy={policy}" -F "x-amz-credential={credential}" -F "x-amz-algorithm={algorithm}" -F "x-amz-date={date}" -F x-amz-signature={signature}" -F "file=@/{Full Path to File}" {url}
An filled in example with some example credentials
curl -v -F 'key=folio/18/1a096-45/${filename}' -F "acl=bucket-owner-read" -F "policy=eyJleHBpcmF0aW9uaXRpb25zIjpbeX0=" -F "x-amz-credential=AKIAE55CD664SSL/aws4_request" -F "x-amz-algorithm=AWS4-HMAC-SHA256" -F "x-amz-date=202708253540Z" -F x-amz-signature="6918f" -F "file=@/mnt/d/Work/file.txt" https://folio-api-upload..com
You’ll know if the file is uploaded successfully if in the response you see the text “We are completely uploaded and fine”
Now that the file is uploaded we can use either createFolio or updateFolio to use that attachment on a Folio. The below example shows how the field response should be setup with the uuid and filename.
mutation {
createFolio(input: {
submitterEmail: "person@example.com"
fieldResponses:[
{
fieldId: "Field-7662"
attachments: {
uuid: "{uuid}"
filename: "{File Name}"
}
}
]
}
)
data {
id
token
}
}