Get Script Content
client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Get(ctx, dispatchNamespace, scriptName, query) (*Response, error)
GET/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content
Fetch script content from a script uploaded to a Workers for Platforms namespace.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Parameters
Get Script Content
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/cloudflare-go"
"github.com/stainless-sdks/cloudflare-go/option"
"github.com/stainless-sdks/cloudflare-go/workers_for_platforms"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
content, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Get(
context.TODO(),
"my-dispatch-namespace",
"this-is_my_script-01",
workers_for_platforms.DispatchNamespaceScriptContentGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", content)
}