How can I run this Curl script from Win10 batch file or command line?










0














New to Curl and I need help getting started....



I need to run the following Curl script from a Win10 batch file and I cannot figure how to modify it to overcome Windows' not allowing cr/lf in the command shell.



Can someone please let me know the changes I need to make?



curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' 
-d 'requestJobDescription=
"type":"file",
"credentials":
"partnerUserID":"xxxxxxxxxxxxxx",
"partnerUserSecret":"xxxxxxxxxxxxxxxxxx"
,
"onReceive":
"immediateResponse":["returnRandomFileName"]
,
"inputSettings":
"type":"combinedReportData",
"filters":
"reportIDList":"1234567,2233445"

,
"outputSettings":
"fileExtension":"csv"

'
--data-urlencode 'template@expensify_template.ftl'


Thanks










share|improve this question


























    0














    New to Curl and I need help getting started....



    I need to run the following Curl script from a Win10 batch file and I cannot figure how to modify it to overcome Windows' not allowing cr/lf in the command shell.



    Can someone please let me know the changes I need to make?



    curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' 
    -d 'requestJobDescription=
    "type":"file",
    "credentials":
    "partnerUserID":"xxxxxxxxxxxxxx",
    "partnerUserSecret":"xxxxxxxxxxxxxxxxxx"
    ,
    "onReceive":
    "immediateResponse":["returnRandomFileName"]
    ,
    "inputSettings":
    "type":"combinedReportData",
    "filters":
    "reportIDList":"1234567,2233445"

    ,
    "outputSettings":
    "fileExtension":"csv"

    '
    --data-urlencode 'template@expensify_template.ftl'


    Thanks










    share|improve this question
























      0












      0








      0







      New to Curl and I need help getting started....



      I need to run the following Curl script from a Win10 batch file and I cannot figure how to modify it to overcome Windows' not allowing cr/lf in the command shell.



      Can someone please let me know the changes I need to make?



      curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' 
      -d 'requestJobDescription=
      "type":"file",
      "credentials":
      "partnerUserID":"xxxxxxxxxxxxxx",
      "partnerUserSecret":"xxxxxxxxxxxxxxxxxx"
      ,
      "onReceive":
      "immediateResponse":["returnRandomFileName"]
      ,
      "inputSettings":
      "type":"combinedReportData",
      "filters":
      "reportIDList":"1234567,2233445"

      ,
      "outputSettings":
      "fileExtension":"csv"

      '
      --data-urlencode 'template@expensify_template.ftl'


      Thanks










      share|improve this question













      New to Curl and I need help getting started....



      I need to run the following Curl script from a Win10 batch file and I cannot figure how to modify it to overcome Windows' not allowing cr/lf in the command shell.



      Can someone please let me know the changes I need to make?



      curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' 
      -d 'requestJobDescription=
      "type":"file",
      "credentials":
      "partnerUserID":"xxxxxxxxxxxxxx",
      "partnerUserSecret":"xxxxxxxxxxxxxxxxxx"
      ,
      "onReceive":
      "immediateResponse":["returnRandomFileName"]
      ,
      "inputSettings":
      "type":"combinedReportData",
      "filters":
      "reportIDList":"1234567,2233445"

      ,
      "outputSettings":
      "fileExtension":"csv"

      '
      --data-urlencode 'template@expensify_template.ftl'


      Thanks







      curl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 20:27









      Tom Repetti

      13




      13






















          1 Answer
          1






          active

          oldest

          votes


















          0














          just remove the trailing 's and replace the newlines with spaces, and it should be cmd/.bat compatible.



          curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription= "type":"file", "credentials": "partnerUserID":"xxxxxxxxxxxxxx", "partnerUserSecret":"xxxxxxxxxxxxxxxxxx" , "onReceive": "immediateResponse":["returnRandomFileName"] , "inputSettings": "type":"combinedReportData", "filters": "reportIDList":"1234567,2233445" , "outputSettings": "fileExtension":"csv" ' --data-urlencode 'template@expensify_template.ftl' 


          uhm, if your json happens to contain any instance of ' however (but the example you provided here does not), you may need to prepend % to them (which acts as an escape character in cmd/.bat), and if the json data happens to include a newline, that newline should be json-escaped with n instead of having the literal newline in the json data (i believe json accepts both newlines and n in place of newlines, but that's asking for trouble with cmd)






          share|improve this answer






















          • I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
            – Tom Repetti
            Nov 14 at 18:13










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269610%2fhow-can-i-run-this-curl-script-from-win10-batch-file-or-command-line%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          just remove the trailing 's and replace the newlines with spaces, and it should be cmd/.bat compatible.



          curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription= "type":"file", "credentials": "partnerUserID":"xxxxxxxxxxxxxx", "partnerUserSecret":"xxxxxxxxxxxxxxxxxx" , "onReceive": "immediateResponse":["returnRandomFileName"] , "inputSettings": "type":"combinedReportData", "filters": "reportIDList":"1234567,2233445" , "outputSettings": "fileExtension":"csv" ' --data-urlencode 'template@expensify_template.ftl' 


          uhm, if your json happens to contain any instance of ' however (but the example you provided here does not), you may need to prepend % to them (which acts as an escape character in cmd/.bat), and if the json data happens to include a newline, that newline should be json-escaped with n instead of having the literal newline in the json data (i believe json accepts both newlines and n in place of newlines, but that's asking for trouble with cmd)






          share|improve this answer






















          • I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
            – Tom Repetti
            Nov 14 at 18:13















          0














          just remove the trailing 's and replace the newlines with spaces, and it should be cmd/.bat compatible.



          curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription= "type":"file", "credentials": "partnerUserID":"xxxxxxxxxxxxxx", "partnerUserSecret":"xxxxxxxxxxxxxxxxxx" , "onReceive": "immediateResponse":["returnRandomFileName"] , "inputSettings": "type":"combinedReportData", "filters": "reportIDList":"1234567,2233445" , "outputSettings": "fileExtension":"csv" ' --data-urlencode 'template@expensify_template.ftl' 


          uhm, if your json happens to contain any instance of ' however (but the example you provided here does not), you may need to prepend % to them (which acts as an escape character in cmd/.bat), and if the json data happens to include a newline, that newline should be json-escaped with n instead of having the literal newline in the json data (i believe json accepts both newlines and n in place of newlines, but that's asking for trouble with cmd)






          share|improve this answer






















          • I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
            – Tom Repetti
            Nov 14 at 18:13













          0












          0








          0






          just remove the trailing 's and replace the newlines with spaces, and it should be cmd/.bat compatible.



          curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription= "type":"file", "credentials": "partnerUserID":"xxxxxxxxxxxxxx", "partnerUserSecret":"xxxxxxxxxxxxxxxxxx" , "onReceive": "immediateResponse":["returnRandomFileName"] , "inputSettings": "type":"combinedReportData", "filters": "reportIDList":"1234567,2233445" , "outputSettings": "fileExtension":"csv" ' --data-urlencode 'template@expensify_template.ftl' 


          uhm, if your json happens to contain any instance of ' however (but the example you provided here does not), you may need to prepend % to them (which acts as an escape character in cmd/.bat), and if the json data happens to include a newline, that newline should be json-escaped with n instead of having the literal newline in the json data (i believe json accepts both newlines and n in place of newlines, but that's asking for trouble with cmd)






          share|improve this answer














          just remove the trailing 's and replace the newlines with spaces, and it should be cmd/.bat compatible.



          curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription= "type":"file", "credentials": "partnerUserID":"xxxxxxxxxxxxxx", "partnerUserSecret":"xxxxxxxxxxxxxxxxxx" , "onReceive": "immediateResponse":["returnRandomFileName"] , "inputSettings": "type":"combinedReportData", "filters": "reportIDList":"1234567,2233445" , "outputSettings": "fileExtension":"csv" ' --data-urlencode 'template@expensify_template.ftl' 


          uhm, if your json happens to contain any instance of ' however (but the example you provided here does not), you may need to prepend % to them (which acts as an escape character in cmd/.bat), and if the json data happens to include a newline, that newline should be json-escaped with n instead of having the literal newline in the json data (i believe json accepts both newlines and n in place of newlines, but that's asking for trouble with cmd)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 at 7:37

























          answered Nov 13 at 7:32









          hanshenrik

          9,59221738




          9,59221738











          • I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
            – Tom Repetti
            Nov 14 at 18:13
















          • I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
            – Tom Repetti
            Nov 14 at 18:13















          I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
          – Tom Repetti
          Nov 14 at 18:13




          I took out all the cr/lf's and the script now executes. It returns errors, but that is for another post. Looking to see if I can solve the errors myself.
          – Tom Repetti
          Nov 14 at 18:13

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269610%2fhow-can-i-run-this-curl-script-from-win10-batch-file-or-command-line%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          27

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          Category:Rhetoric