If you POST binary data to API Gateway, can you also pass text attributes as well?

I want to POST an image to an API Gateway and I see that this is now possible after reading this: Binary Support for API Integrations with Amazon API Gateway | AWS Compute Blog

Is it possible to add additional attributes to the request as well or can it only contain the image?

On the page I linked, there is a section called Body Mapping Template and it shows:

{
“operation”: “thumbnail”,
“base64image”: $input.body
}

My question is can I do something like this:

{
“operation”: “thumbnail”,
“base64image”: “$input.body.image”,
“otherData”: “$input.body.otherData”
}

or something similar.

Thanks in advance! (And sorry for yet another question)

Edit/Update: I think I found a better way to accomplish what I want to do. I’m going to upload the image to S3 with some metadata. The upload will trigger a lambda function, then I can use the image in the lambda with the metadata. Then image is only needed for text recognition, so once I get what I need from it, I’ll remove it from S3 in order to save space.


Related discussions:

Yes, you want to use multipart/form-data. Each “field”, whether binary or text will be a part.

Thanks. I’ll look into that!

Would I need to set that up in the body mapping template? If so, how?

Is that supported in API GW? I didn’t think so.

It may be easier to just use custom headers.

Could I just do what this person did:

https://stackoverflow.com/questions/41557109/aws-api-gateway-form-data-support

?

The image is just encoded and sent as text, then I need to decode it back to an image but it just sends over the wire as a normal string.