Hello

I have a very simple problem to solve but I've not been capable of sorting
out.

Have one REST remote webservice from Marvel, and would like to create a
route that calls that webservice, gets the JSon response, and finally
prints out 3 of its attributes.

One told me the easiest approach would be to use an HTTP adapter and then a
json component.

This is what I have for now :

                from("
http://gateway.marvel.com:80/v1/public/comics?dateDescriptor=nextWeek&ts=987&apikey=97f295907072a970c5df30d73d1f3816&hash=abfa1c1d42a73a5eab042242335d805d
").
                        unmarshal().json(JsonLibrary.Jackson).
                        setBody(simple("my attributes are :
${body?.code?}")).
                        to("stream:out");

But in the setBody line I dont get anything.....

The structure of the JSON is like this :

{
  "code": "int",
  "status": "string",
  "data": {
    "offset": "int",
    "limit": "int",
    "total": "int",
    "results": [
      {
        "id": "int",
        "digitalId": "int",
        "title": "string",
        "description": "string",
        "prices": [
          {
            "type": "string",
            "price": "float"
          }
        ],
        "thumbnail": {
          "path": "string",
          "extension": "string"
        } ] }
}

And I would like to get the values for "code", "data.results.title",
"data.results.prices.price", "data.results.thumbnail.path"

Any help ?


[image: Inline image 2]

* Jonathan Vila    ** <https://www.twitter.com/jonathan_vila>
<http://www.linkedin.com/in/jonathanvila>*


* jonathan.v...@gmail.com <jonathan.v...@gmail.com>*

Reply via email to