Skip to main content

Test web APIs with the .NET Core HTTP REPL tool.

# To install the dotnet core core httprepl tool globally:
dotnet tool install -g Microsoft.dotnet-httprepl

# To connect the REPL to a web API:
httprepl <root_uri>

# To connect to a Swagger documented API:
connect <root_uri> --swagger <swagger_uri>

# To View available endpoints of a web API:
<root_uri>/<endpoint>~ ls

# To open a Swagger web API documentation page in a web browser:
<root_uri>/<endpoint>~ ui

# To navigate to a different endpoint on the web API:
<root_uri>/<endpoint>~ cd <people>

# To view available settings:
<root_uri>/<endpoint>~ pref get

# To change the `colors.json` key value from Green to White:
<root_uri>/<endpoint>~ pref set colors.json White

# To set the default text editor:
pref set editor.command.default "<executable>"

# To pass the default credentials of the logged in user to all endpoints (NOTE: must exit and restart the tool before sending another request to the web API):
pref set httpClient.useDefaultCredentials true

# To send a bearer token to an endpoint:
set header Authorization "bearer <token_value>"

# To issue a GET request:
<root_uri>/<endpoint>~ get

# To retrieve a specific record by passing a parameter to the get command:
<root_uri>/<endpoint>~ get 2

# To issue an HTTP POST request:
<root_uri>/<endpoint>~ post -h Content-Type=application/json

# To issue an HTTP PUT request:
<root_uri>/<endpoint>~ put 2 -h Content-Type=application/json

# To issue an HTTP DELETE request:
<root_uri>/<endpoint>~ delete 2

# To show/hide the HTTP request being sent, set echo to on|off:
<root_uri>/<endpoint>~ echo on