pydo.cdn.update_endpoints()

Description

To update the TTL, certificate ID, or the FQDN of the custom subdomain for an existing CDN endpoint, send a PUT request to /v2/cdn/endpoints/$ENDPOINT_ID.

Parameters

Name Type Required Description Default Value
cdn_id string True A unique identifier for a CDN endpoint.
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

update_req = {
    "ttl": 3600,
    "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
    "custom_domain": "static.example.com",
}

update_resp = client.cdn.update_endpoints("19f06b6a", update_req)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

The response will be a JSON object with an endpoint key. This will be set to an object containing the standard CDN endpoint attributes.

Click to expand an example response for CDN Endpoint.
{
  "value": {
    "endpoint": {
      "id": "19f06b6a-3ace-4315-b086-499a0e521b76",
      "origin": "static-images.nyc3.digitaloceanspaces.com",
      "endpoint": "static-images.nyc3.cdn.digitaloceanspaces.com",
      "created_at": "2018-07-19T15:04:16Z",
      "ttl": 3600
    }
  }
}
Click to expand an example response for CDN Endpoint With Custom Domain.
{
  "value": {
    "endpoint": {
      "id": "19f06b6a-3ace-4315-b086-499a0e521b76",
      "origin": "static-images.nyc3.digitaloceanspaces.com",
      "endpoint": "static-images.nyc3.cdn.digitaloceanspaces.com",
      "created_at": "2018-07-19T15:04:16Z",
      "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
      "custom_domain": "static.example.com",
      "ttl": 3600
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}