Skip to main content
Question

How to construct a JSON object with a webhook

  • February 20, 2021
  • 2 replies
  • 96 views

I am trying to construct a webhook that can be consumed by an application. The basic idea is that I pass a variable to the webhook and it retrieves data and there is only a single object that is passed back.

 

I have been able to create it to look like this:

[

    {

        "barcode": "C000176",

        "assetid": "F01239",

        "description": "Dell Inc. - Latitude 7490",

        "type": "Office Equipment",

        "location": "Building 1"

    }

]

 

I need it to be presented like this:

    {

        "barcode": "C000176",

        "assetid": "F01239",

        "description": "Dell Inc. - Latitude 7490",

        "type": "Office Equipment",

        "location": "Building 1"

    }

 

I have been able to create a text file (JSON) that produces something like what I am looking for when I am on the desktop. The second I publish it to the server and try postman, I am getting an error (FME Data Streaming Service Failed to Complete).

 

In the below image the connected one produces the array with the [square brackets]. The _result of the JSONTemplator is perfect, but I haven't found a way to write it to a json file that produces the results desired in a webhook. The disconnected text file, creates the file correctly on my desktop, but gives the error when I publish it and try to call the API.

 

Capture

2 replies

hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • February 21, 2021

When you're publishing to server, is it being published as a streaming service?

Also on your textFile writer, try setting the MIME Type to application/json

Screenshot 2021-02-22 075356


hkingsbury wrote:

When you're publishing to server, is it being published as a streaming service?

Also on your textFile writer, try setting the MIME Type to application/json

Screenshot 2021-02-22 075356

It is being published as a data streaming service. I have it set to application/json. Including a few additional screenshots of the text output. Capture4Capture3Capture2


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings