簡體   English   中英

通過Postman發送JSON的timstamp

[英]Send a timstamp in JSON via Postman

我很擅長使用REST API和Postman,我正在尋找一種方法,通過Postman將時間戳作為字符串包含在POST請求體中。

根據Postman文檔 ,有一個動態變量{{$timestamp}}可以在請求體中使用。 但是,當我嘗試使用它時,我從正在發布的端點獲得400返回,並顯示消息“格式錯誤的數據”。

以下是我嘗試的幾種變體:

變異1

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

變異2

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

變異3

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

所有這些都返回了相同的錯誤

{
  "errorMessage": "malformed data",
  "error": true
}

謝謝@NimS和@JAAulde:Varation 2是正確答案。 這個問題肯定是一個錯字。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM