import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
ca_certificate = client.cdn.trusted_ca_certificates.replace(
id=0,
name="Example CA cert 2",
)
print(ca_certificate.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
caCertificate, err := client.CDN.TrustedCaCertificates.Replace(
context.TODO(),
0,
cdn.TrustedCaCertificateReplaceParams{
Name: "Example CA cert 2",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", caCertificate.ID)
}
curl --request PUT \
--url https://api.gcore.com/cdn/sslCertificates/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Example CA cert 2"
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Example CA cert 2'})
};
fetch('https://api.gcore.com/cdn/sslCertificates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cdn/sslCertificates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Example CA cert 2'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.gcore.com/cdn/sslCertificates/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Example CA cert 2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/sslCertificates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Example CA cert 2\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Example CA certificate",
"deleted": true,
"cert_issuer": "example.com",
"cert_subject_cn": "example.com",
"cert_subject_alt": "DNS:example.com",
"validity_not_before": "2020-06-26T12:03:53Z",
"validity_not_after": "2021-06-26T12:03:53Z",
"sslCertificateChain": "",
"hasRelatedResources": false
}Change trusted CA certificate
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
ca_certificate = client.cdn.trusted_ca_certificates.replace(
id=0,
name="Example CA cert 2",
)
print(ca_certificate.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
caCertificate, err := client.CDN.TrustedCaCertificates.Replace(
context.TODO(),
0,
cdn.TrustedCaCertificateReplaceParams{
Name: "Example CA cert 2",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", caCertificate.ID)
}
curl --request PUT \
--url https://api.gcore.com/cdn/sslCertificates/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Example CA cert 2"
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Example CA cert 2'})
};
fetch('https://api.gcore.com/cdn/sslCertificates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cdn/sslCertificates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Example CA cert 2'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.gcore.com/cdn/sslCertificates/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Example CA cert 2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/sslCertificates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Example CA cert 2\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Example CA certificate",
"deleted": true,
"cert_issuer": "example.com",
"cert_subject_cn": "example.com",
"cert_subject_alt": "DNS:example.com",
"validity_not_before": "2020-06-26T12:03:53Z",
"validity_not_after": "2021-06-26T12:03:53Z",
"sslCertificateChain": "",
"hasRelatedResources": false
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
CA certificate ID.
Body
CA certificate name.
It must be unique.
"Example CA cert 2"
Response
Successful.
CA certificate ID.
1
CA certificate name.
"Example CA certificate"
Defines whether the certificate has been deleted. Parameter is deprecated.
Possible values:
- true - Certificate has been deleted.
- false - Certificate has not been deleted.
true
Name of the certification center that issued the CA certificate.
"example.com"
Domain name that the CA certificate secures.
"example.com"
Alternative domain names that the CA certificate secures.
"DNS:example.com"
Date when the CA certificate become valid (ISO 8601/RFC 3339 format, UTC.)
"2020-06-26T12:03:53Z"
Date when the CA certificate become untrusted (ISO 8601/RFC 3339 format, UTC.)
"2021-06-26T12:03:53Z"
Parameter is deprecated.
""
Defines whether the CA certificate is used by a CDN resource.
Possible values:
- true - Certificate is used by a CDN resource.
- false - Certificate is not used by a CDN resource.
false
Was this page helpful?