Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
client.cdn.cdn_resources.prevalidate_ssl_le_certificate(
0,
)package main
import (
"context"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.CDN.CDNResources.PrevalidateSslLeCertificate(context.TODO(), 0)
if err != nil {
panic(err.Error())
}
}
curl --request POST \
--url https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate \
--header 'Authorization: <api-key>'const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate', 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/resources/{resource_id}/ssl/le/pre-validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"errors": [
"An error occurred when connecting to the validation URL. Please ensure that DNS records are pointed to our services, and check whether the rules you created overlap the path \"/.well-known/acme-challenge/\". If you have just created a CDN resource, it may take up to 15 minutes to activate it. In this case, please wait until the CDN resource is activated and try to issue the certificate again. Problem detected: The connection timed out."
]
}Let's Encrypt certificates
Pre-validate CDN resource before issuing Let's Encrypt certificate
Check whether a Let’s Encrypt certificate can be issued for the CDN resource.
POST
/
cdn
/
resources
/
{resource_id}
/
ssl
/
le
/
pre-validate
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
client.cdn.cdn_resources.prevalidate_ssl_le_certificate(
0,
)package main
import (
"context"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.CDN.CDNResources.PrevalidateSslLeCertificate(context.TODO(), 0)
if err != nil {
panic(err.Error())
}
}
curl --request POST \
--url https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate \
--header 'Authorization: <api-key>'const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate', 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/resources/{resource_id}/ssl/le/pre-validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/resources/{resource_id}/ssl/le/pre-validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"errors": [
"An error occurred when connecting to the validation URL. Please ensure that DNS records are pointed to our services, and check whether the rules you created overlap the path \"/.well-known/acme-challenge/\". If you have just created a CDN resource, it may take up to 15 minutes to activate it. In this case, please wait until the CDN resource is activated and try to issue the certificate again. Problem detected: The connection timed out."
]
}Was this page helpful?