I am having trouble calling smartsheets api with powershell Invoke-Restmethod cmdlet. The attached script has worked before. See error message regarding SSL/TLS below.
$apiKey = "**********"
$url = "https://api.smartsheet.com/2.0/sheets"
$get_headers = @{"Authorization" = "Bearer " + $apiKey}
$put_headers = @{}
$put_headers.Add("Authorization", "Bearer " + $apiKey)
$put_headers.Add("Content-Type", "application/json")
$response = Invoke-RestMethod -Uri $url -Headers $get_headers
Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure
channel.
Is there anyway around this error?
The Smartsheet API dropped support for TLS 1.0, which is the default for Powershell.
The link Palansen shared above has some good solutions. Basically, you'll need to tell Powershell to use TLS 1.2 when invoked.