Using the API: Updating the subCA certificate of a domain

1 users found this article helpful

Resolution

This article provides a PowerShell example of updating the subCA certificate of a domain.

It assumes you've already authenticated to the API.

If you followed the steps to create a trusted roots file, you can simply copy the contents of the .PEM/.CER file. Those contents should begin with "-----BEGIN CERTIFICATE-----" and end with "-----END CERTIFICATE-----" followed by a new line.

For the PFX file, make sure to encode it using base64.

To discover the URL to the auth provider, query https://workspace.company.com/api/v2/domains/?limit=1000 and find your domain. Check the value of the "auth_provider" property.


Invoke-WebRequest -UseBasicParsing -Uri "https://workspace.company.com/api/v2/domains/4/" `
-Method PATCH `
-WebSession $session `
-Headers @{
"Accept" = "application/json, text/plain, */*"
  "Referer" = "https://workspace.company.com/"
} `
-ContentType "application/json;charset=utf-8" `
-Body "{
 `"sso_trusted_roots`":`"-----BEGIN CERTIFICATE-----\r\nbase64_encoded_string==\r\n-----END CERTIFICATE-----\r\n\r\n`",
 `"sso_ca_cert_pkcs_12_file`":`"base64_encoded_string`",
 `"sso_ca_cert_pkcs_12_pwd`":`"some_password_for_the_pfx_file",
 `"auth_provider`":`"https://workspace.company.com/api/v2/auth-providers/10/`",
 `"sso_enabled`":true
}"

Was this article helpful?

Tell us how we can improve it.