-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-template.ps1
More file actions
32 lines (26 loc) · 1.19 KB
/
update-template.ps1
File metadata and controls
32 lines (26 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Disable SSL certificate validation
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$apiKey = "38154aafd6867378cb200f31661aa4ed524bb64aa8d91f6d1ad0d61fb8f695fa"
$headers = @{
Authorization = "Bearer $apiKey"
"Content-Type" = "application/json"
}
# Get current template
$template = Invoke-RestMethod -Uri "https://localhost:3333/api/templates/1" -Headers $headers
# Update envelope sender
$template | Add-Member -NotePropertyName "envelope_sender" -NotePropertyValue "IT Support <itsupport@equippers.com>" -Force
# Convert to JSON
$body = $template | ConvertTo-Json -Depth 10
# Update template
$result = Invoke-RestMethod -Uri "https://localhost:3333/api/templates/1" -Method PUT -Headers $headers -Body $body
Write-Host "Updated! New envelope_sender: $($result.envelope_sender)"