Question

Uploading file via API (HTTPCaller)

  • 1 December 2023
  • 2 replies
  • 25 views

Badge +7

G'day,

We have some Asset software which has an API available, on the most part we are interfacing with the API well. There is an upload component which I have never been able to automate, yet I can use the manual swagger page to test it out no worries.

 

The swagger page with the /api/geo/add_geo_package can be found here - https://api-albury.conquest.live/swagger/#/GeoPackageImportService/GeoPackageImportService_AddGeoPackage

 

Basically, I need to manually click 'choose file' from the webpage, which I can do, but I want to automate this step using FME, so I don't know how to replace the manual "choose file" button with a simple file path location to tell it where the file is currently located.

 

I have just noticed there is an 'upload file' option in FME, I am trying to implement this, it seems straightforward, so I have setup my tranformer as per this screenshot:

 

configuration to upload file via api 

This runs well, but the _output field is empty, and the swagger site provided above states that I should be provided with a string as a result of this upload. Instead it shows code 200 (success) and the string is blank. I am not sure if I have done something wrong? See output in the above screenshot.

 

This is what swagger indicates should be returned as the response body:

swagger /geo/add_geo_package 

edit: found the upload option, but still cant get it working. modified the question accordingly.

 


2 replies

Userlevel 3
Badge +17

Hi @benvk​ ,

I'm not sure if it's your case but sometimes API won't work as expected if specified Content Type was wrong.

Have you tried setting "Binary (application/octet-stream)" to the Content Type parameter?

Badge +7

Hi @benvk​ ,

I'm not sure if it's your case but sometimes API won't work as expected if specified Content Type was wrong.

Have you tried setting "Binary (application/octet-stream)" to the Content Type parameter?

Hi Takashi, thanks for the reply. I tried the Binary option as you highlighted, but this resulted with no change.

 

It is worth noting that when I run a successful test via the swagger website, I can see the Curl, and it notes 'Content Type: Multipart/form-data'.

 

Successful Submit/Response Information 

FME does not appear to have a direct comparison to this.

HTTPCaller Body Parameters

Reply