Sending a JSON payload as a single message

Comments

6 comments

  • Avatar
    Kevin Keech

    If you're sending only a single message within the payload of a request to the HTTPs source endpoint then what you'll want to do is enable the Advanced flag for "One Message Per Request" (disable the multi-line option) With this option enabled the request payload will be considered as a single message. 

    1
    Comment actions Permalink
  • Avatar
    Jason Friedman

    Thanks @kevin I'll give it a shot:

    >>> message1
    'Hello world'
    >>> message2
    '{"MONITOR_NAME": "customer.sql", "SCHEDULED_FOR_STAMP": "2023-02-05 13:55:00 PST",   "RECORDS_IN_PAST_75_MINUTES": 9}'
    >>> requests.post(url, message1)
    <Response [200]>
    >>> requests.post(url, message2)
    <Response [200]>
    0
    Comment actions Permalink
  • Avatar
    Jason Friedman

    Message seems to have been rejected (it does not appear in my search, whereas the post of "Hello world" does appear).

    0
    Comment actions Permalink
  • Avatar
    Kevin Keech

    Given the 200 response code the second message should be there. I suspect that due to the timestamp in the message that you might need to search for this message using a time frame that covers that date/time.  Otherwise if you try the "receipt time" search option the message may show up along with the other as this option ignores any parsed timestamps and just shows messages based on when Sumo received them. 

    1
    Comment actions Permalink
  • Avatar
    Jason Friedman

    Thanks Kevin I will check.

    0
    Comment actions Permalink
  • Avatar
    Jason Friedman

    Kevin you da man!

    0
    Comment actions Permalink

Please sign in to leave a comment.