0

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?

Alex
  • 5
  • 1
  • 2
  • 3
  • 1
    See here: https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel – Palansen Dec 07 '18 at 19:43

1 Answers1

3

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.

Taylor Krusen
  • 963
  • 6
  • 10