Passing a JSON file as a file while passing dynamic fields to the file

Greetings DrapCode team, @vishsahu @alitanwir , I am having a small confusion here that I would like you to help clear.

My external API use case goes like this: I want to upload a file to IPFS. Its body parameter only requires a file. From the documentation, I am supposed to upload the file two times. The first file shall give a hash to use in the next call, and there is no problem with that. My confusion is on the next call, which again requires a metadata.json file; this is where I need an explanation. I want the ability to pass dynamic JSON fields to the metadata.json, but in this case, the metadata.json is being expected as a file itself and as form data, not raw JSON.

So, my question is: how do I upload metadata as a file while also passing the metadata fields as dynamic? Do I have to prepare the metadata file, save the file in a drive, and upload the JSON manually for every mint/upload, or is there a way you would suggest handling this situation? I don’t have a problem working with APIs, but the need to handle a file upload in consecutive identical calls while preserving the form data approach is disturbing my progress. Please help.

Hi @Nigel - Since this is not a standard flow, I can think of one solution that involves using an AWS Lambda function. Define the workflow logic in an AWS Lambda function, and call it via its URL from DrapCode’s External API, passing the custom values along. This way, you’ll be able to send the dynamic values in the format you receive in the AWS Lambda function, and then you can make a final API call to IPFS.
I hope this helps.

thank you @alitanwir . let me check if i works for me and be back if i need help

Hie @alitanwir i checked out a video done by @Vishal on using AWS lamda via developer API and its very complicated . I coundnt get anything from the time he started doing some advanced computations . Please may you assist with this problem