ralish / PSCiscoSupportAPIs

PowerShell interface to the Cisco Support APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PSCiscoSupportAPIs

pwsh ver pwsh dl license

A PowerShell interface to the Cisco Support APIs.

Requirements

Installing

PowerShellGet (included with PowerShell 5.0)

The module is published to the PowerShell Gallery:

Install-Module -Name PSCiscoSupportAPIs

ZIP File

Download the ZIP file of the latest release and unpack it to one of the following locations:

  • Current user: C:\Users\<your.account>\Documents\WindowsPowerShell\Modules\PSCiscoSupportAPIs
  • All users: C:\Program Files\WindowsPowerShell\Modules\PSCiscoSupportAPIs

Git Clone

You can also clone the repository into one of the above locations if you'd like the ability to easily update it via Git.

Did it work?

You can check that PowerShell is able to locate the module by running the following at a PowerShell prompt:

Get-Module PSCiscoSupportAPIs -ListAvailable

Configuring

API credentials

You must provide your API credentials to make requests. This can be done by either:

  • Setting the $CiscoApiClientId and $CiscoApiClientSecret variables globally.
  • Providing the -ClientId and -ClientSecret parameters on command invocation.

Command parameters take precedence over any globally configured API credentials.

Response formats

All commands support outputting the response in several formats:

  • PSObject (default)
    A PSCustomObject which maps the fields in the JSON response. The raw response may be manipulated to improve its representation (e.g. using optimal .NET types). Formatting information is included for these objects, making them typically the easiest to work with, particularly interactively.
  • JSON
    A String containing the raw JSON response. You can pipe this to ConvertFrom-Json to generate a PSCustomObject representation. Note this will not give you the same result as the PSObject response format, which performs additional manipulation alongside formatting data to provide a "native" PowerShell experience.
  • WebResponse
    A BasicHtmlWebResponseObject which includes the response metadata (e.g. status code, HTTP headers, etc ...) alongside the response content. The Content property contains the raw JSON response and is identical to that returned in the JSON response format.

The response format is controlled by:

  • Setting the $CiscoApiResponseFormat variable globally.
  • Providing the -ResponseFormat parameter on command invocation.

Command parameters take precedence over any globally configured response format.

API endpoints

The following table shows the required API for each command:

API Name API Version Command(s)
Automated Software Distribution v4 Get-CiscoSoftwareDownload
Get-CiscoSoftwareRelease
Get-CiscoSoftwareStatus
Product Information v1 Get-CiscoProductInformation
Serial Number to Information v2 Get-CiscoCoverageInformation
Get-CiscoOrderableProductId
Service Order Return (RMA) v1 Get-CiscoServiceOrderReturn
Software Suggestion v2 Get-CiscoSoftwareSuggestion

Troubleshooting

Encountering unexpected behaviour or other problems? You may wish to run the problematic command with the -Verbose parameter for more details. You can also add the -Debug parameter for even more details on the command processing.

If you think you've found a bug please consider opening an issue so that I can look into it and hopefully get it fixed!

License

All content is licensed under the terms of The MIT License.

About

PowerShell interface to the Cisco Support APIs

License:MIT License


Languages

Language:PowerShell 100.0%