我刚发现(自去年十月以来)WordPress的REST API也适用于自己托管的WordPress网站,所以我现在可以通过PowerShell来访问我的博客了。
$posts = Invoke-RestMethod -uri "https://public-api.wordpress.com/rest/v1/sites/www.verboon.info/posts/?number=50" $posts.posts | Select-Object @{"Name" = "Title";"e"= {($_.Title)-replace "–","-"}}, @{"Name" = "Date"; "Expression" = {get-date ($_.Date) -Format "yyyy-MMM-dd"}} | ft
输出示例:
Title Date ----- ---- PowerShell – Using the WordPress Rest API 2013-12月-30 PowerShell – Creating Scheduled Tasks with PowerSh... 2013-12月-30 PowerShell – Get latest Microsoft KB information 2013-12月-17 PowerShell – Get Stock Quote Information 2013-12月-15 ConfigMgr OSD – Enable .NET Framework 3.5 on Windo... 2013-12月-14 PowerShell – How to qukckly access the Azure Manag... 2013-12月-10 Windows 8.1 – Shutdown and Shutdown 2013-12月-10 PowerShell – Retrieve App-V 4.6 Package Information 2013-12月-03 PowerShell – Yet another Sysinternals download script 2013-12月-02
更过wordpress Rest API详细信息可以参考这里
原文作者:Alex Verboon
原文链接:PowerShell – Using the WordPress Rest API
本文链接: https://www.pstips.net/using-the-wordpress-rest-api.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!