我需要与PowerShell的连接MongoDB地图集API的帮助。使用bash,它可以完美地工作。
curl --include --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
"https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}?pretty=true"但是我也想做同样的事情,Powershell,有人能帮我吗?
发布于 2020-12-11 19:06:57
@RamanSilopal非常感谢你的链接:)我已经把它转换成了PowerShell:
$ApiPrivateKey
$ApiPublicKey
$Uri = 'https://cloud.mongodb.com/api/atlas/v1.0/groups/{ORG-ID}/accessList?pretty=true'
[securestring]$secStringPassword = ConvertTo-SecureString $ApiPrivateKey -AsPlainText -Force
[pscredential]$credential = New-Object System.Management.Automation.PSCredential ($ApiPublicKey, $secStringPassword)
Invoke-RestMethod -Uri $Uri -ContentType Application/Json -Headers @{Authorization = “Basic $base64AuthInfo”} -Credential $credential -Method Gethttps://stackoverflow.com/questions/65248800
复制相似问题