< Back

Invoke-lmAPI

Sat Jan 18, 2020 9:52 am

NAME Invoke-lmAPI



SYNOPSIS

Constructs headers and invokes the LM API as documented





SYNTAX

Invoke-lmAPI [-Resource] <String> [-HttpVerb {Default | Get | Head | Post | Put | Delete | Trace | Options | Merge

| Patch}] [-Query <Hashtable>] [-Body <Object>] [<CommonParameters>]



Invoke-lmAPI [-Resource] <String> [-HttpVerb {Default | Get | Head | Post | Put | Delete | Trace | Options | Merge

| Patch}] -AccessId <String> -AccessKey <SecureString> -Company <String> [-Query <Hashtable>] [-Body <Object>]

[<CommonParameters>]





DESCRIPTION





PARAMETERS

-Resource <String>

The resource path to connect to



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HttpVerb

The HTTP verb to use for this request



Required? false

Position? named

Default value Get

Accept pipeline input? false

Accept wildcard characters? false



-AccessId <String>

AccessId for this API



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AccessKey <SecureString>

AccessKey for this API



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Company <String>

Company for this API



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Query <Hashtable>

Dictionary to be constructed into a QueryString



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <Object>

Body of the request



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





If you use "Connect-lmAPI" first, other calls to this command will not need the connection info (company,

accesskey and accessid)

All calls after the first in a script can forgo that information as well.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>An example



$Key = Read-Host -AsSecureString

<Type your access key>

Invoke-LMApi -Resource device/devices -Query @{size=100} -AccessId 'xpY57I5qB82YE9T79E3q' -AccessKey $Key

-Company TDS









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Using file for storing key - will only run if everything is run as the same windows user.



$Key = Read-Host -AsSecureString | Export-CLIxml -Path .\\lmKey.xml

<Type your access key>



#Later, in a script

$Key = Import-CliXml -Path .\\lmKey.xml

Invoke-LMApi -Resource device/devices -Query @{size=100} -AccessId 'xpY57I5qB82YE9T79E3q' -AccessKey $Key

-Company TDS











RELATED LINKS