Skip to main content
Question

How to use event's parameter on REST API payload


  • Fan
  • 3 replies

We have the following payload and would like to use the event’s parameter {{TRIGGERED_ON}} on the “timestamp” key.

{
  "something": [
    {
      "akey": "avalue",
      "type": 0,
      "points": [
        {
          "timestamp": 1234567890,
          "value": 0.1
        }
      ]
    }
  ]
}

 

7 replies

dima
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 83 replies
  • July 21, 2022

Seems like a good use case for the Expression Evaluator processor. It can modify the record’s field on the data in motion.  


  • Author
  • Fan
  • 3 replies
  • July 21, 2022

This is needed to be done on the “Subscription” section of Control Hub as a webhook payload


dima
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 83 replies
  • July 21, 2022

Ah, got it. Our docs have some examples about doing things like that. 


  • Author
  • Fan
  • 3 replies
  • July 21, 2022

Using the parameters as string has no issue, the timestamp needs to be sent as number, and so the curly brackets for the parameter conflict with JSON formatting.


dima
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 83 replies
  • July 21, 2022

Not sure I follow as the examples include sending a JSON payload. What error are you seeing?


  • Author
  • Fan
  • 3 replies
  • July 21, 2022

HTTP 400 Bad Request error.

Tried with the following and also wrapping {{TRIGGERED_ON}} with double quotes

{
  "something": [
    {
      "akey": "avalue",
      "type": 0,
      "points": [
        {
          "timestamp": {{TRIGGERED_ON}},
          "value": 0.1
        }
      ]
    }
  ]
}

 


dima
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 83 replies
  • July 21, 2022

Can you take a screenshot of the whole subscription configuration screen? Be sure to blur out any sensitive info. 


Reply