API¶
API keys¶
You can generate any number of API keys under Settings
Manage API keys
.
These API keys will only be shown once and thereafter hashed and encrypted in the database, so remember to take note of the API keys when shown the first time.
The complete API documentation has been moved to Swagger UI inside TrustView, under the `Support
section,
in the upper right corner of the top navigation of TrustView.
Legacy API¶
Danger
It is recommended to avoid setting up these API handles in a production workflow, as they will be moved to the new API framework in the future, and therefore changes will inevitably occur.
Certificate checkout¶
TrustView allows you to check out your certificates using API calls.
The checkout API has 2 URLs:
1POST trustview.your-url.org/api/monitoredsslcertificates/checkout
2POST trustview.your-url.com/api/monitoredocescertificates/checkout
One to check out SSL certificates and one to check out OCES (MitID Erhverv) certificates. The API key and relevant fields are the same for both, except that SSL certificates support 2 additional file types. This extra data is posted as a JSON object. The JSON object should look similar to this:
1 {"apikey":"x4309sdfm",
2 "certificateId":24,
3 "password":"idqw0932",
4 "keyStoreType":"pkcs12",
5 "comments":"API test comment"}
The API key field is the API key string. The certificateId is the database ID of the certificate. The password is
the string by which to encrypt the keystore file. The keystore type is the checkout file format.
The available file types are pkcs12
and jks
.
SSL certificates can also be checked out with pfx
or pem
format.
Finally, the comment field is an optional field to give context to what the checkout is used for.
The call will return a status 200
and the bytes of the file if successful, or an error status and text if not.
An error will also be logged. The checkout will be saved in the checkout history, with the name of the API key as the user.
Tip
The ID of an monitored object can be found by entering the edit page for it in TrustView and looking at the browser URL.
Certificate import¶
TrustView allows you to import SSL and other certificates by using API calls. The parameters are identical to those used to manually import a certificate.
The import API has two URLs:
1POST trustview.your-url.org/api/monitoredsslcertificates/
2POST trustview.your-url.org/api/monitoredcertificates/
One to import SSL certificates and another to import other certificates. The parameters are the same for both.
The parameters for the certificate import should be included in a JSON format similar to this:
1 {"apikey":"x4309sdfm",
2 "certificate":"MIIFzTCCBLWgAwIBAgIQDueitDozhMm2oAZlUslm+jANBgkqhkiG9w0BAQsFADB1
3 MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4 d3cu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20 CCsGAQUFBwMCMHUGA1UdHwRuMGwwNKAyoDCGLmh0dHA6Ly9jcmwzLmRpZ2ljZXJ0
21 LmNvbS9zaGEyLWV2LXNlcnZlci1nMS5jcmwwNKAyoDCGLmh0dHA6Ly9jcmw0LmRp
22 Z2ljZXJ0LmNvbS9zaGEyLWV2LXNlcnZlci1nMS5jcmwwQgYDVR0gBDswOTA3Bglg
23 hkgBhv1sAgEwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29t
24 L0NQUzCBiAYIKwYBBQUHAQEEfDB6MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5k
25 aWdpY2VydC5jb20wUgYIKwYBBQUHMAKGRmh0dHA6Ly9jYWNlcnRzLmRpZ2ljZXJ0
26 LmNvbS9EaWdpQ2VydFNIQTJFeHRlbmRlZFZhbGlkYXRpb25TZXJ2ZXJDQS5jcnQw
27 DAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAQEAVmbxaK32dQNuV5KROTdm
28 WuEjgpzwmJqLbCucdbCYoIpgint2Nae0ss5v09QGy0prhsxbaB3Qc7M6NHVrGqwj
29 qWVPC7rZEPkLMI5dhBxo4M6E5YQKkNTj6ZXVJqKc/RCfa+JchR9kVSVELMmgKeG1
30 08dNQXjkrek1gMZ0nwaU1C1nKoykh2rrJGcRqoHp0TLNDKVPgu1LOEuNerDgVdFl
31 G218FWVrNbGo0+fYTJUqb6Q23nNjM4HO15QtsXCMYnwuXOHq79qjA4RJUHJp5dcT
32 QcBW7sF+nMJuYsXNOuq9poJoT+MZ/0a5dDR9RDKObeBNZzUWFBnZhNRnt0i5hKnA
33 6Q==",
34 "comment":"trustskills cert",
35 "customField1":"foo",
36 "customField2":"bar",
37 ...
38 "customField10":"baz"
39 }
The API key field is the API key string. The certificate field is the certificate itself. The comment and custom fields are optional, matching the comment field and the custom fields from 1 to 10.
When POSTING to /api/monitoredsslcertificates/
, TrustView will ignore the value of name
and overwrite it the same way as if you imported the certificate manually in TrustView.
When POSTING to /api/monitoredcertificates/
, TrustView will use the value of name
in the name field of the certificate.
The call will return a status 201
if successful, or an error status and text if not. The error will also be logged.
Note
Note that the call will be rejected if a custom field value is given and the custom field is not enabled for SSL certificates, or does not match one of the approved values.
Certificate deletion¶
TrustView allows you to delete certificates in the other category by using API calls.
The deletion API has the following URL:
1DELETE trustview.your-url.org/api/monitoredcertificates/delete
The parameters for the certificate deletion should be included in a JSON format similar to this:
1 {"apikey":"x4309sdfm",
2 "certificate":"MIIFzTCCBLWgAwIBAgIQDueitDozhMm2oAZlUslm+jANBgkqhkiG9w0BAQsFADB1
3 MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4 d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk
5 IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE0MTEyNjAwMDAwMFoXDTE1MTIwMTEy
6 MDAwMFowgeMxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYB
7 BAGCNzwCAQMTAkRLMREwDwYDVQQFEwgzNTQ2Nzk1NTEhMB8GA1UECRMYSW5nZSBM
8 ZWhtYW5ucyBHYWRlIDEwLCA2MQ0wCwYDVQQREwQ4MDAwMQswCQYDVQQGEwJESzEP
9 MA0GA1UECBMGQWFyaHVzMREwDwYDVQQHEwhBYXJodXMgQzEYMBYGA1UEChMPVFJV
10 U1RTS0lMTFMgQXBTMR0wGwYDVQQDExR2aWV3LnRydXN0c2tpbGxzLmNvbTCCASIw
11 DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANMHGEREUGbqnV8iLjGIe01tv8nT
12 WA0fI19bc3AfpYEKUCF0j4w2/1i3LGgGq6vCTbdQ3mbRSroltRMHLbQo/s/KimMj
13 O5NipIyCG2zcSTC//1VAI4skc74sXe5QmwUMynZcn9QlX63LAkIgP3gbC9U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Tj6ZXVJqKc/RCfa+JchR9kVSVELMmgKeG1
30 08dNQXjkrek1gMZ0nwaU1C1nKoykh2rrJGcRqoHp0TLNDKVPgu1LOEuNerDgVdFl
31 G218FWVrNbGo0+fYTJUqb6Q23nNjM4HO15QtsXCMYnwuXOHq79qjA4RJUHJp5dcT
32 QcBW7sF+nMJuYsXNOuq9poJoT+MZ/0a5dDR9RDKObeBNZzUWFBnZhNRnt0i5hKnA
33 6Q=="
34 }
The API key field is the API key string. The certificate field is the certificate to be deleted.
The call will return a status 200
if successful, or an error status and text if not. The error will also be logged.