-
Notifications
You must be signed in to change notification settings - Fork 19
Response Hyperlinks (HATEOAS)
Every time you request data from the API it returns a list of URI links. The API has this to say about them:
This API follows Hypermedia as the Engine of Application State (HATEOAS) principals and is therefore hypermedia friendly. Hyperlinks are returned in the links property of any given resource and contain a fully-qualified hyperlink to the corresponding resource. The format of the hypermedia link adheres to both the {json:api} v1 "Link Object" and JSON Hyper-Schema "Link Description Object" formats.
For a PowerShell module, these links are of little use and can clutter up the output. An example result is shown below...
assets : 20
description : Site UK A
id : 18
importance : normal
links : {@{href=https://<URL>:3780/api/3/sites/18; rel=self}, @{href=https://<URL>:3780/api/3/sites/18/alerts; rel=Alerts}, @{href=https://<URL>:3780/api/3/sites/18/scan_engine; rel=Scan Engine}, @{href=https://<URL>:3780/api/3/sites/18/scan_schedules; rel=Schedules}...}
name : UKA
riskScore : 183026.0
scanEngine : 5
scanTemplate : discovery
type : static
vulnerabilities : @{critical=85; moderate=90; severe=520; total=695}
assets : 20
description : Site UK A
id : 18
importance : normal
name : UKA
riskScore : 183026.0
scanEngine : 5
scanTemplate : discovery
type : static
vulnerabilities : @{critical=85; moderate=90; severe=520; total=695}
By default my module will remove these links from almost all output that is generated. There are some very specific use-cases when they are needed. For example, when no other output is given after a successful operation.
If you feel you really do want these links, simply add a new global variable called NexposeShowLinks and give it a value of $true.
New-Variable -Name 'NexposeShowLinks' -Value $true