0

I've just seen snippet of code on developer.twitter.com

  'curl --request POST \
  --url https://api.twitter.com/1.1/tweets/search/30day/<ENV>.json \
  --header 'authorization: Bearer <BEARER_TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
                "query":"from:TwitterDev lang:en",
                "maxResults": "100",
                "fromDate":"<YYYYMMDDHHmm>", 
                "toDate":"<YYYYMMDDHHmm>"
                }'

page of api

Using cmd command line or Windows power shell i receive error because of multiline format of the code. However everything is ok for string without line breaks.

My question is - Where i can run this snippet of code without errors?

  • Welcome to Stackoverflow! Please share the error you are facing. This will help others to help you or ask more questions. – Michael Heil Apr 07 '20 at 16:11

1 Answers1

0

This command works in bash and zsh on Linux and Mac - I have not been able to test it on Windows. In PowerShell, the multi-line continuation character is backtick `. Remember to replace the <ENV> and <BEARER_TOKEN> values and to edit or remove the fromDate and toDate parameters. Also, the leading single quote is not from the documentation page, so you'll need to remove that as well.

Andy Piper
  • 11,422
  • 2
  • 26
  • 49
  • 1
    Thank you for answer. Of course i know about replacement. I'm just surprised, that twitter declares "copy and run" and does not point out where and how. Direct way for windows user does not work. – Лия Иванова Apr 07 '20 at 10:27
  • Thank you for the feedback - I'll add this to our documentation suggestions. – Andy Piper Apr 07 '20 at 11:47