Question

How to enable the get method for web hook?

  • 16 January 2023
  • 5 replies
  • 17 views

I am trying to use webhook with the FME server, and the service requires the web server must support GET/ to confirm the reachability of the server.

 

How do I enable GET within the FME server's automation to return a success message?

 


5 replies

Badge +6

Hi @brandonguo​ ,

 

The Webhook Trigger creates a URL endpoint that another application can POST or GET a request to. If the automation is active and the webhook trigger exists, FME Server returns a 202 OK. If the automation is inactive or the webhook trigger is invalid, it returns a 404 not found.

 

You might also be interested in the FME Server REST API's Healthcheck endpoint. This GET request does not require authentication and returns a response to confirm availability.

 

If you'd like the Automation to check if another system is reachable, you can make GET requests with the HTTP Request External Action or run a workspace containing an HTTPCaller.

 

Hope that helps!

Hi @brandonguo​ ,

 

The Webhook Trigger creates a URL endpoint that another application can POST or GET a request to. If the automation is active and the webhook trigger exists, FME Server returns a 202 OK. If the automation is inactive or the webhook trigger is invalid, it returns a 404 not found.

 

You might also be interested in the FME Server REST API's Healthcheck endpoint. This GET request does not require authentication and returns a response to confirm availability.

 

If you'd like the Automation to check if another system is reachable, you can make GET requests with the HTTP Request External Action or run a workspace containing an HTTPCaller.

 

Hope that helps!

Thank you @sanaeatsafe​ .

On the other service, I got an error code 422 "message": "A JSONObject text must begin with '{' at 1 [character 2 line 1]"

I asked the other service to provide an example; their body JSON file starts with "[".

Any method to configure automation to accept array JSON file? Thank you.

Badge +6

Thank you @sanaeatsafe​ .

On the other service, I got an error code 422 "message": "A JSONObject text must begin with '{' at 1 [character 2 line 1]"

I asked the other service to provide an example; their body JSON file starts with "[".

Any method to configure automation to accept array JSON file? Thank you.

Does the other service's webhook request specify JSON in the headers? e.g. content-type=application/json. If that is the case, the webhook trigger only accepts JSON object literals. Therefore the JSON must be surrounded by curly braces {"key": "value", "key1": "value1"}. Unfortunately, arrays are not accepted unless they're inside an object.

 

However, the webhook trigger also accepts text and URL-encoded data. If it is an option, please change the content-type header to text/plain or application/x-www-form-urlencoded. Any text, JSON or not, may be accepted using either header. However, for the latter, you may need to decode the webhook message in a workspace using the TextDecoder transformer. As well, both require parsing JSON inside a workspace as opposed to webhook keys inside the automation.

Badge +6

Thank you @sanaeatsafe​ .

On the other service, I got an error code 422 "message": "A JSONObject text must begin with '{' at 1 [character 2 line 1]"

I asked the other service to provide an example; their body JSON file starts with "[".

Any method to configure automation to accept array JSON file? Thank you.

There is a table for Working with non-JSON Data in the documentation that says which encoding will be used for each header, including some other options besides the ones I mentioned.

Thank you @sanaeatsafe​ .

On the other service, I got an error code 422 "message": "A JSONObject text must begin with '{' at 1 [character 2 line 1]"

I asked the other service to provide an example; their body JSON file starts with "[".

Any method to configure automation to accept array JSON file? Thank you.

@sanaeatsafe​ 

Thank you. From my testing on Postman, if I change the content-type from JSON to TEXT, it works. I'll ask the service provider to see if they are willing to make any changes, as I have no control over that.

I am new to the API world, and I was just wondering if the content-type is JSON, the body can't start with "[", is this a standard or else? An array is still an acceptable JSON file type?

Reply