I want to get post information of a specific user from Twitter from PowerShell.
The command used to get post information is “Invoke-RestMethod”.
Please let me know the OAuth authentication procedure required at that time.
The following information has been obtained.
- ・API key
- ・API secret key
- ・Access token
- ・Access token secret
2
Answers
The easiest way to access the twitter api in PowerShell is to use one of the modules, that wrap around it, like MyTwitter.
A detailed description on how to get started with the this module can be found here: https://adamtheautomator.com/twitter-module-powershell/.
If you have to avoid external modules, you can use
Invoke-RestMethod
to call the api directly.The article linked above describes, how to create an access token and the api reference can be found here: https://developer.twitter.com/en/docs/tweets/search/api-reference
Another option is PSTwitterAPI. It provides a function for +125 Twitter API endpoints.
For more info: https://github.com/mkellerman/PSTwitterAPI