Extending Bash shell variable in Curl in Cmder

On a Window 7 machine in a Cmder emulator in a Git bash window, I am trying to write the current date in ISO format:

$ date +%s 1513354497 

to send a POST request inside the body:

 $curl.sh -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"restricted":true,"marquardtRole":"ContentStreamReservedTagMARQUARDTBIWEEKLYUPDATE","description":"Bi-weekly update covering Marquee development and go-to-market functions.","assetClasses":["Commodities","Credit","Currencies","Economics","Emerging Markets","Equities Macro","Equities Micro","Interest Rates","Prime Services"],"authoringDivision":"SECDIV","titlePattern":"(?i)Marquardt Weekly Update.*","name":"Marquardt BIWEEKLY UPDATE", "updatedBy": "d37286ac275911d788f1b1f11ac60222","updated":"'"date +%s"'"}' "http://localhost.abc.com:8000/maq-app-cnts/services/pubs" 

Here is the exception that I get:

 <!-- The request did not match any of the requests defined for this endpoint. Request definition 1: The JSON object in the body does not conform to the schema error: instance type (string) does not match any allowed primitive type (allowed: [&quot;integer&quot;]) level: &quot;error&quot; schema: {&quot;loadingURI&quot;:&quot;definition:/DateTimeInteger#&quot;,&quot;pointer&quot;:&quot;&quot;} instance: {&quot;pointer&quot;:&quot;/updated&quot;} domain: &quot;validation&quot; keyword: &quot;type&quot; found: &quot;string&quot; expected: [&quot;integer&quot;] --> 

How to pass date +%s curl for proper extension in bash?

Thanks.

0
source share
1 answer

Instead of '... ,"updated":"'"date +%s"'"}' use '... ,"updated":"'"$(date +%s)"'"}' See fooobar .com / questions / 1221049 / ...

0
source

All Articles