Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-13341

FIWARE.Question.Tech.How to use attribute metadata token in Orion Context Broker notification custom payload (NGSIV2)?.

    Details

      Description

      Created question in FIWARE Q/A platform on 16-08-2017 at 16:08
      Please, ANSWER this question AT https://stackoverflow.com/questions/45717033/how-to-use-attribute-metadata-token-in-orion-context-broker-notification-custom

      Question:
      How to use attribute metadata token in Orion Context Broker notification custom payload (NGSIV2)?

      Description:
      NGSIv2 clients can customize HTTP notification messages using a simple template mechanism.

      Considering the following notification notification.httpCustom object:

      "httpCustom": {
      "url": "http://foo.com/entity/$

      {id}

      ",
      "headers":

      { "Content-Type": "text/plain" }

      ,
      "method": "PUT",
      "qs": {
      "type": "$

      {type}

      "
      },
      "payload": "The temperature is $

      {temperature} degrees"
      }


      The token ${temperature}

      will be parsed by current context value.

      Thinking that attribute could have a metadata value could contain custom data like a temperature.scale, to store values of '°C' or '°F' for example. How can I print it in that message?

      Although attributes metadata there are 2 Special metadata in notifications:

      previousValue. The value of this metadata must be the previous value of the associated attribute. The type of this metadata must be
      the previous type of the associated attribute. If the type/value of
      previousValue is the same type/value than in the associated attribute,
      then the attribute has not actually changed its value.
      actionType. It is included if the attribute to which it is attached was included in the request that triggered the notification.
      Its value depends on the request operation type: update for updates,
      append for the creation and delete for deletion. Its type is always Text.

      The final result should be a message like that:

      The temperature is now -10 °C degrees before was 9.1 °C degrees

      Is it possible, who to use ?

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:51|CREATED monitor | # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:51|CREATED monitor | # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:54|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:54|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 20:03|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 20:03|UPDATED status: transition Finish| # answers= 1, accepted answer= True

          People

          • Assignee:
            fermin Fermín Galán
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: