Five Stars

Route: getting URI parameters and send custom ResponseCode

Hey all

I'm currently trying to develop a route for creating a rest service, but I have two issues :

 

1/ Getting URI parameter

I use a cCXFRS with the URI pattern /{id}, but don't find any ways to retrieve the id in the road (body/header) nor in the cTalendJob that I use after that. What is the best way to do it ?

 

2/ Sending a custom ResponseCode

I wish to choose the response code sending back by the road, by configuring it in the tRouteOutput of my cTalendJob, but no way to find the correct syntax to add it. Same question that above ^^

 

Thanks

 

Capture.JPG

 

  • ESB
2 REPLIES
Five Stars

Re: Route: getting URI parameters and send custom ResponseCode

Hello,
Nobody have any clues ?
One Star

Re: Route: getting URI parameters and send custom ResponseCode

Hi,

Answer to your first question

One way of retrieving the id in your route is to use the cSetHeader component by following the below steps.

  1. Add a cSetHeader component to the canvas
  2. Click the Add (Plus sign) button in Basic settings in the Component tab
  3. Enter your chosen header name in Name column
  4. Choose Simple in the Language column
  5. Enter "${headers.CamelCxfMessage[jaxrs.template.parameters][id][0]}" in the Value column

Now the header you created above will have the value of id