Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Camel Spring HTTP Consumer using remote Rest web service

$
0
0
Hi, I need some help setting up my camel configuration to consume data from a
remote rest web service using camel. This remote service is https and uses
api-key for authentication. I also need to POST to this web service with a
query as well to get data returned.

I need help with how to pass the query to the POST. Also if you see
anything else that could be done cleaner please let me know.

Below is the query that I must pass to the web service:

"sinceTime": time,

"untilTime": time,

"timezoneOffset": 0,

"details": {

"widgetType": "Place"

},

"filters": [

"dimension": "SOURCE",

"filterValues": [

"Site1",

"Site2"

],

"metric": "TEST",

"start": 0,

"rows": 200

As a side note I am using JBoss Developer Studio as this will eventually run
in an JBoss environment.

Below is the code that I currently have:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-http.xsd">

<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<to
uri="https://api.host.com/api/v3.1/link/query/place/?apiKey=1234"/>
<log message="Message Recieved"/>
<to uri="file:target/messages/test"/>
</route>
</camelContext>
</beans>

Viewing all articles
Browse latest Browse all 5648

Trending Articles