Hi Mike,
The core problem you are facing is that the Dropbox Request node expects to receive a JSON structure from the message flow node which precedes it in your flow. When you go through the discovery process, the Dropbox Request node returns to the flow developer a JSON schema that describes what this structure looks like. This file is saved into your application project ... its name is a concatenation of the name of your message flow and the name of the Dropbox node and the last sections tell you if the schema is for the request or the response (returned back to the flow developer for use in downstream nodes. In my case I created a flow called "DropboxExample" and my Dropbox Request node is called "Dropbox Request" and I have the following JSON schemas in my project:
DropboxExample.Dropbox_Request.request.schema.json
DropboxExample.Dropbox_Request.response.schema.json
When you go through the discovery process, you will see a section near the top of the discovery dialog (after you have connected to Dropbox) which is called "Controls". There is a little twistie to expand and contract the section which will reveal an enumerated dropdown which can be set to either "Use input message unchanged" or "Define mappings below".
For your usecase, you appear to have data coming in to Dropbox which is not defined in a JSON schema ... so defining a mapping in JSONata as part of the discovery process is not an option for you. If you *did* have a JSON schema, then you could use that on the Map Inputs table property on the node ... I can see you tried to do this in one of your screen shots but this won't work because the data being passed into the Dropbox Request node is not in the JSON domain. Sooo ... given your situation, you should select the options in "Controls" to be "Use input message unchanged" and then we can deal with the mapping part of the puzzle in your message flow before reaching the Dropbox Request node.
There are several ways in which you can take binary data from an input node and map it into a JSON domain message ready for the DropboxRequest node. I have created a simple example which uses a FileInput node with the BLOB domain to read in the file, and then a graphical map node to convert the BLOB message into a JSON message ready for the Dropbox Request node. I used the JSON schema mentioned at the top of this post to model the target of the graphical map, and I selected the BLOB domain for the source of the graphical map. My map looks like this:
As you can see there are a handful of fields to control what Dropbox should do ... the "Assign" mappings are telling Dropbox where to write the file ... so for "path" I added an Assign of the value "ACE_BenThompson" because this is the name of the folder I have set up in my instance of Dropbox. For the "name" field I assigned the value of "myfilename.txt" which is the name of the file I'm writing in to the Dropbox folder. For the "fileType" field I assigned the value of "Text" (I think the other valid option is "Binary" but I didn't figure out how to pass in binary values directly as part of my quick playing around). For the "fileContent" I wanted to cast the BLOB (hexBinary) data coming in as a text string ... Graphical maps use XSLT or XPath functions to help out with mappings and I couldnt find a handy built in function, so I stole a little snippet of code which I've used in the past (I actually took this from one of the other tutorials in ACE Toolkit titled "File - Using the FileInput node with Delimited record detection") .. I used this with the "Custom XPath" mapping option:
codepoints-to-string(
for $index in (1 to string-length(string($value)))[. mod 2 = 1],
$hinibble in (substring(string($value), $index, 1)),
$lonibble in (substring(string($value), $index + 1, 1))
return
(16 * string-length(substring-before('0123456789ABCDEF', upper-case($hinibble)))) +
string-length(substring-before('0123456789ABCDEF', upper-case($lonibble))))
Pulling it all together, I was able to get your scenario to work as shown in the screenshots below ... I can provide the example project interchange and flow if you'd like a copy.
------------------------------
Ben Thompson
IBM UK
------------------------------
Original Message:
Sent: Mon May 20, 2024 07:33 PM
From: Mike Lamb
Subject: Dropbox create file example
Attached are the message in and out of the Dropbox request node
------------------------------
Mike Lamb
Product Manager
IBM
Austin TX
------------------------------