Send a temporary rack to JSON via Postman

I'm new to REST API and Postman, and I'm looking for a way to include timestamp as a string in the body of a POST request through Postman.

According to Postman docs, there is a dynamic variable {{$timestamp}}that can be used in the request body. However, when I try to use it, I get 400 back from the endpoint to which I go, with the message "garbled data".

Here are some options I've tried:

option 1

[
    {
        "from_number": "+123456789",
        "messages": [
            {
                "text":  "Message at" {{$timestamp}},
                "to_number": "+123456789"
            }
        ]
    }
]

option 2

[
    {
        "from_number": "+123456789",
        "messages": [
            {
                "text":  "Message at {{$timestamp}}",
                "to_number": "+123456789"
            }
        ]
    }
]

variation 3

[
    {
        "from_number": "+123456789",
        "messages": [
            {
                "text":  "Message at " + {{$timestamp}},
                "to_number": "+123456789"
            }
        ]
    }
]

They all returned the same error.

{
  "errorMessage": "malformed data",
  "error": true
}
+4
source share
1 answer

Thanks @NimS and @JAAulde: Varation 2 is the correct answer. The problem should be a typo.

+4
source

Source: https://habr.com/ru/post/1598393/


All Articles