Benutzer-Werkzeuge

Webseiten-Werkzeuge


windows:powershell_irm_curl_wget

Dies ist eine alte Version des Dokuments!


curl / wget in der Powershell - Testen von ORDS Webservices in der Powershell über die Console

Unter Linux läßt sich eine Webseite mit curl oder wget sehr einfach abfragen.

Invoke-WebRequest

Als Befehlt steht beides auch in der Powershell zur Verfügung, curl/wget sind als Alias für das cmdlet „Invoke- WebRequest“ hinterlegt.

Invoke-RestMethod

In der Powershell steht einem dafür „Invoke-RestMethod“ bzw als alias „irm“ zur Verfügung.

Aufruf:

Invoke-RestMethod -Uri http:\\localhost:9090  
 
oder
 
irm -Uri http:\\localhost:9090

REST Service abfragen

Beim Abfragen eines Webservice, zum Beispiel vom ORDS ⇒ Oracle ORDS 3.0 REST API nativ verwenden ist die Verwendung dieses Befehls sehr praktisch, ein Json Record wird gleich als Tabelle dargestellt.

irm -Uri http://127.0.0.1:9090/ords/gpi/api/version/
 
version
-------
1

Optionen

Invoke-RestMethod bzw. irm

PS C:\work> help irm
 
NAME
    Invoke-RestMethod
 
SYNTAX
    Invoke-RestMethod [-Uri] <uri> [-Method {Default | Get | Head | Post | Put | Delete | Trace | Options | Merge | Patch}] [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>]
    [-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>] [-Certificate <X509Certificate>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>]
    [-MaximumRedirection <int>] [-Proxy <uri>] [-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <string>] [-TransferEncoding {chunked | compress | deflate | gzip |
    identity}] [-InFile <string>] [-OutFile <string>] [-PassThru]  [<CommonParameters>]
 
 
ALIASES
    irm
 
 
REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Invoke-RestMethod -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=217034.

Invoke-WebRequest bzw. curl/wegt

PS C:\work> help curl
 
NAME
    Invoke-WebRequest
 
SYNTAX
    Invoke-WebRequest [-Uri] <uri> [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>] [-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>]
    [-Certificate <X509Certificate>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>] [-MaximumRedirection <int>] [-Method {Default | Get | Head | Post | Put | Delete | Trace |
    Options | Merge | Patch}] [-Proxy <uri>] [-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <string>] [-TransferEncoding {chunked | compress | deflate | gzip |
    identity}] [-InFile <string>] [-OutFile <string>] [-PassThru]  [<CommonParameters>]
 
 
ALIASES
    iwr
    wget
    curl
 
 
REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Invoke-WebRequest -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=217035.

Quellen

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
windows/powershell_irm_curl_wget.1540139165.txt.gz · Zuletzt geändert: 2018/10/21 18:26 von gpipperr