Skip to main content

I’m using a HTTPcaller connect to a swagger API that ONLY receives raw JSON data in the Upload Body or uploading a file (one block of JSON data per file). I can’t pass through any parameters from a attributemanager. When I try to pass through a parameter in the Upload body of the HTTPcaller, I get this error message:

Attribute(string: UTF-8)          : `_response_body' has value `{"errors":{{"code":400,"message":"A non-empty request body is required.","title":""},{"code":400,"message":"The dto field is required.","title":"dto"}]}'

When I try to pass through {“active”: true, “firstName”: “@Value(firstName)”}, I get this error: 

Attribute(string: UTF-8)          : `_response_body' has value `{"errors":_{"code":400,"message":"The dto field is required.","title":"dto"},{"code":400,"message":"',' is an invalid start of a value. Path: $.active | LineNumber: 1 | BytePositionInLine: 12.","title":"$.active"}]}'

I need to use the POST method to create an employee but I can only create one employee per call. I will have at least 2 or 3 employees to create at a time. 

Or How can I upload multiple files for the HTTPcaller? I tried to use the wildcard (file*.csv) but I get an error that it’s translating the folder path/name as the raw data. I know I can use the multipart/Form data but I want it to grab all the files in a folder, not just particular file names. 

Any recommendations how to do this? 

The “dto field is required” error should be ignored, if I Google around it looks like it’s bad error handling.

Does the API has any documentation? I would prefer to go the JSON route, but it would be nice to have some docs to start with. If I understand correctly you should be able to create a JSON body in a AttributeCreator upstream of the HTTPCaller, and use that with the POST request.

If you need to go the multipart route, several possibilities. One way could be:

  • Creator to initiate process.
  • FeatureReader to read you data rows.
  • TempPathnameCreator to create a temp path for the file.
  • FeatureWriter to create a file for each row in the temp path.
  • HTTPCaller to do the multipart upload, upload the file the FeatureWriter created.

It is easier to create the process without the TempPathnameCreator and only add it when it works.


@nielsgerrits Thank you for the recommendation. I did get it working!! :) 


Reply