In continuation of my other question, here my problem with POST:
Thanks to user qqilihq I managed the GET portion with token authentication to work with Palladium HTTP-Retriever.
I also managed a POST request, where I upload a JSON text to the API of the system.
For one particular case though, I have to upload a complete (text) file; the file (name) is outside of the JSON string, meaning you need a multiple body content (or whatever it is called).
I manage this in POSTMAN (but that seems to support dummies like me very well, thus doesn't really count?).
In another thread I was also given the hint of it not really being possible with the POST node from Knime, but perhaps the Palladian could do it.
So I guess, the question is how to make a multiple body content to pass through the node?
Here are two examples for CURL and for RUBY:
curl -H X-CDD-Token:$TOKEN -F ‘file=@path/to/file.csv’ --form-string ‘json={"different stuff1", "different":"stuff2"}’ ‘https://app.collaborativedrug.com/api/v1/vaults/23/slurps’
RestClient.post 'https://app.collaborativedrug.com/api/v1/vaults/23/slurps', {:file => File.new("path/to/file.csv"), :json => '{"different stuff1", "different":"stuff2"}'}, {:"X-CDD-Token" => ‘<API_TOKEN>’ }
Postman makes for example (parts of) Ruby looks like this:
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
request["x-cdd-token"] = 'API_TOKEN'
request["cache-control"] = 'no-cache'
request["postman-token"] = '12122ced-da0a-da7d-0770-37400e5effe7'
request.body = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"C:\\Users\\Alex\\AppData\\Roaming\\Postman\\IndexedDB\\file__0.indexeddb.blob\\1\\00\\72\"\r\nContent-Type: false\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"json\"\r\n\r\n{\"different stuff1\", \"different\":\"stuff2\"}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--
So, I guess I could try to pull the file (or the path?) together with my JSON into a single cell and use that for POST? Problem is how to create such a "string" and where do I get/create a token (here postman-token) from? Do I actually need something like that? I made an attempt, but probably don't have the filepath in the correct format (tried several ones) - I concatenate it with the JSON portion (comma separated), but that didn't work so far.
I enclose an example workflow, the HTTP part won't work because of the token, so perhaps it won't do much good? Sorry about that.
Appreciate any thoughts and inputs! Thank you for your time!