Can I use information from a geoevent definition in a HTTP/JSON output connector URL?

732
1
12-19-2016 09:56 AM
ThomasWeitzel
New Contributor II

I'd like to use GeoEvent to push data to a RESTful web service. The service follows REST conventions for resources where the ID of the resource is part of the service URL. To properly construct the URL for my output connector then, I need to pull data out of the geoevent definition data and append it to the URL to which GeoEvent will attempt an HTTP PUT. 

For example, the data that's sent to my HTTP/JSON output connector looks something like

{

  "ID":"99-001",

  "Latitude":33.58202,

  "Longitude":-117.1234

}

The URL needs to be something like http://server/action/ID where the 'ID' part of the path needs to be replaced with the ID attribute from the data above.

Is this possible?

 

Thanks,

Tom

0 Kudos
1 Reply
MarkBramer
Occasional Contributor II

Hi Tom (tweitzel),

I'm fairly certain what you want to do is not possible without a custom output.  I tried messing around with the syntax GeoEvent wants when referring to field values inside geoevents (${FIELD_NAME}).  While I was able to set this in my output URL (I had to escape the three special characters), the special characters were interpreted literally by the HTTP transport.

I had my JSON/HTTP output URL set to:

http://<server_name>:8080/REST-receiver/webresources/Items/%24%7bID%7d 

In my REST server app's log, I was getting:

id= ${ID}
id= ${ID}

whereas if I called my server app via REST directly (via ChromePoster), I would get:

id= 99-001
id= {
"ID":"99-001",
"Latitude":33.58202,
"Longitude":-117.1234
}

So it appears that the HTTP transport sends its bytes payload to the literal URL specified for "URL:" and does not attempt field substitutions like other transports do, i.e. SMTP.

Mark

0 Kudos