The Video Stitcher API downloads video assets to insert ads into them. Video assets are usually distributed using a content delivery network, also known as a CDN. To protect the content, video asset URLs can require a signature in order to be retrieved; this is known as URL signing.
If a video asset requires a signature, the Video Stitcher API must know the CDN key to retrieve the media. Additionally, the Video Stitcher API uses these keys to tokenize the media segments for the client device.
This document describes how to create and manage CDN keys. For more details, see the REST documentation.
Register a CDN key
If the video asset is protected by URL signing, a CDN key must be registered with the Video Stitcher API.
To register the CDN key, use the
projects.locations.cdnKeys.create
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: A user-defined identifier for the CDN key, which will become the final component of the CDN key's resource name. This ID can only contain lower-case letters, numbers, and hyphens. The first character must be a letter, the last character must be a letter or a number, and the entire ID has a 63 character maximum.CDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the keyset name of the Media CDN keyMEDIA_CDN_KEYNAME
: The 64-byte Ed25519 private key as a base64-encoded string. See Create a private key for Media CDN for more information.MEDIA_CDN_PRIVATE_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME ", "privateKey": "MEDIA_CDN_PRIVATE_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID "
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME ", "privateKey": "MEDIA_CDN_PRIVATE_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "create", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
OPERATION_ID
,
which is the last part of the name
field, to use in the next section.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: A user-defined identifier for the CDN key, which will become the final component of the CDN key's resource name. This ID can only contain lower-case letters, numbers, and hyphens. The first character must be a letter, the last character must be a letter or a number, and the entire ID has a 63 character maximum.CDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the name of the Cloud CDN keyGCDN_KEYNAME
: the base64-encoded string secret for the Cloud CDN keyGCDN_PRIVATE_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "googleCdnKey": { "keyName": "GCDN_KEYNAME ", "privateKey": "GCDN_PRIVATE_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID "
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "googleCdnKey": { "keyName": "GCDN_KEYNAME ", "privateKey": "GCDN_PRIVATE_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "create", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
OPERATION_ID
,
which is the last part of the name
field, to use in the next section.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: A user-defined identifier for the CDN key, which will become the final component of the CDN key's resource name. This ID can only contain lower-case letters, numbers, and hyphens. The first character must be a letter, the last character must be a letter or a number, and the entire ID has a 63 character maximum.CDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the base64-encoded string token key for the Akamai CDN edge configurationAKAMAI_TOKEN_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "akamaiCdnKey": { "tokenKey": "AKAMAI_TOKEN_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID "
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "akamaiCdnKey": { "tokenKey": "AKAMAI_TOKEN_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys?cdnKeyId=CDN_KEY_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "create", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
OPERATION_ID
,
which is the last part of the name
field, to use in the next section.
Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API C# API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Go API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Java API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Node.js API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API PHP API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Ruby API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Check for the result
To check if the CDN key has been created, use the
projects.locations.operations.get
method. If the response contains "done: false"
, repeat the command until the
response contains "done: true"
.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location of the data; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: the identifier for the operationOPERATION_ID
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID "
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "endTime":END_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "create", "cancelRequested": false, "apiVersion": "v1" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.video.stitcher.v1.CdnKey", "name": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME " } } }
Create a private key for Media CDN
The Video Stitcher API expects ed25519 private keys to be a concatenation of the key seed and the public key. To create a private key compatible with the Video Stitcher API using the ed25519 generated private key, run the following commands:
# Extract the "key seed" from the private key openssl pkey -outform DER -intest.private.key | tail -c +17 >> tmp.key # Extract the "public key" from the private key openssl pkey -outform DER -pubout -intest.private.key | tail -c +13 >> tmp.key # Concatenate both parts in an intermediary key and base64-encode the resulting value head -c 64 tmp.key | python3 -c "import base64, sys; print(('%s' % base64.urlsafe_b64encode(sys.stdin.buffer.read()))[2:-1])"
Get a CDN key
To get the details for a specific CDN key, use the
projects.locations.cdnKeys.get
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings page.PROJECT_NUMBER
: the location where your CDN key is located; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: a user-defined identifier for the CDN keyCDN_KEY_ID
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID "
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME " } }
Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API C# API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Go API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Java API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Node.js API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API PHP API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Ruby API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Update a CDN key
To update a specific CDN key, use the
projects.locations.cdnKeys.patch
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: a user-defined identifier for the CDN keyCDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the keyset name of the Media CDN keyMEDIA_CDN_KEYNAME
: The 64-byte Ed25519 private key as a base64-encoded string. See Create a private key for Media CDN for more information.MEDIA_CDN_PRIVATE_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME ", "privateKey": "MEDIA_CDN_PRIVATE_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,media_cdn_key"
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME ", "privateKey": "MEDIA_CDN_PRIVATE_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,media_cdn_key" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "update", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: a user-defined identifier for the CDN keyCDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the name of the Cloud CDN keyGCDN_KEYNAME
: the base64-encoded string secret for the Cloud CDN keyGCDN_PRIVATE_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "googleCdnKey": { "keyName": "GCDN_KEYNAME ", "privateKey": "GCDN_PRIVATE_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,google_cdn_key"
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "googleCdnKey": { "keyName": "GCDN_KEYNAME ", "privateKey": "GCDN_PRIVATE_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,google_cdn_key" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "update", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create your CDN key; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: a user-defined identifier for the CDN keyCDN_KEY_ID
: the hostname of the CDN to associate with this CDN key (for example, an IP address likeHOSTNAME 35.190.60.252
or a domain name likecdn.example.com
)
: the base64-encoded string token key for the Akamai CDN edge configurationAKAMAI_TOKEN_KEY
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "hostname": "HOSTNAME ", "akamaiCdnKey": { "tokenKey": "AKAMAI_TOKEN_KEY " } } EOF
Then execute the following command to send your REST request:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,akamai_cdn_key"
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "hostname": "HOSTNAME ", "akamaiCdnKey": { "tokenKey": "AKAMAI_TOKEN_KEY " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ?updateMask=hostname,akamai_cdn_key" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "update", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API C# API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Go API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Java API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Node.js API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API PHP API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Ruby API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
List all registered CDN keys
To list all of the CDN keys registered for a given location in a
project, use the
projects.locations.cdnKeys.list
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location where your CDN keys are located; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys"
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "cdnKeys": [ { "name": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "hostname": "HOSTNAME ", "mediaCdnKey": { "keyName": "MEDIA_CDN_KEYNAME " } }, { "name": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "hostname": "HOSTNAME ", "googleCdnKey": { "keyName": "GCDN_KEYNAME " } }, { "name": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/my-other-cdn-key ", "hostname": "my-other-hostname ", "akamaiCdnKey": {} } ] }
Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API C# API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Go API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Java API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Node.js API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API PHP API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Ruby API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional results
The curl
response may include a nextPageToken
, which you can use to retrieve
additional results:
{ "cdnKeys": [ ... ], "nextPageToken": "NEXT_PAGE_TOKEN " }
You can send another curl
request, including the value of
NEXT_PAGE_TOKEN, to list the additional CDN keys. Append the
following to the URL in the preceding API call:
?pageToken=NEXT_PAGE_TOKEN
See the relevant client library for more information on using this token.
Delete a CDN key
If a registered CDN key is no longer needed, delete it using the
projects.locations.cdnKeys.delete
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location where your CDN key is located; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
: a user-defined identifier for the CDN keyCDN_KEY_ID
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID "
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://videostitcher.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /cdnKeys/CDN_KEY_ID ", "verb": "delete", "cancelRequested": false, "apiVersion": "v1" }, "done": false }
Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API C# API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Go API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Java API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Node.js API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API PHP API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Ruby API reference documentation.
To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Rotate a CDN key
To rotate a CDN key, do the following:
- Add a new key in the desired CDN (for example, Media CDN).
- Register the new key in the Video Stitcher API. At this point, the Video Stitcher API signs resources using the old key or the new key. Both keys are valid credentials for the CDN.
Delete the old CDN key in the Video Stitcher API.
The Video Stitcher API caches the old CDN keys. The cache typically expires within 5 minutes. After the cache expires, the Video Stitcher API uses only the new key to sign resources. You can verify that the new key is working by checking that the resources are still accessible.
Remove the old key from the desired CDN.
Verify that the signed URI returned by the Video Stitcher API is still valid and accessible.