0

I am trying to send a csv file from snaplogic to an api endpoint using through a REST POST snap but it doesn't seem to actually send the file as the response says file not found

when I do the post through postman it just fine and use the same information I use in the snap

my settings in the POST snap are as follows:

  • Label*= REST Post Service URL*=http://(ip:port)/v1/innovazones HTTP

  • entity=(blank) Batch size=(blank) Show all headers(selected) Single

  • file upload: File=…/shared/TEMPcsv.csv Single file upload: File

  • key=file Single file upload: Filename to be used=innovaZones_csv_file

  • Upload transfer request type=calculate content length Upload body

  • type=Multipart form data Single file upload: Multipart Content-Type=text/csv

  • HTTP header:

  • Key=Content-Type;Value=application/x-www-form-urlencoded

  • key=Authorization Value="Bearer " + account.access_token

  • Trust all certificates*(checked) Follow redirects*(checked)

I should be getting this message:
{
    "status": "success",
    "message": "Data transmitted successfully",
    "payload": {}
}

but I get this in the response instead:

"error": "REST API service endpoint returned error result: status code = 400, reason phrase = Bad Request"

"error_entity": {
    "status":"fail",
    "message":"File not found",
    "payload":{
         "message":"File not found",
         "statusCode":400,
         "status":"fail"
    }
 }

"original": {filename:../shared/TEMPcsv.csv, result:overwritten, original:{, ...}}

"filename": "../shared/TEMPcsv.csv"

"result": "overwritten"

Bilesh Ganguly
  • 3,792
  • 3
  • 36
  • 58
RFT
  • 1
  • 3

1 Answers1

0

You have not added the actual files to upload. You have only set the name of the file.

As per the SnapLogic documentation -

Single file Upload: Filename to be used

This property can be configured if you are uploading a file, the value entered in this field will be treated as the name for the file being uploaded. You can retain the original file name by leaving this property blank.

What you also need to do is point to the actual file you want to upload in the Upload file(s) section.

Again, from SnapLogic documentation -

Upload File(s)

Lists out the file keys and file names of the files that you want to upload. By default, the Settings popup displays the fields required to upload a single file. Click the + button to add new rows to this fieldset. For each file that you want to upload, you need to specify the upload-file key, the location and name, the name of the file in the destination directory, and the multi-part content type associated with the file that you want to upload.

Please refer to - SnapLogic Docs - REST POST

Bilesh Ganguly
  • 3,792
  • 3
  • 36
  • 58