Track CDM uploads and exports
Check the status of a configuration-data upload and list a deployable's exports.
When to use this pattern
- You've pushed component or collection configuration through
Uploads()and need to poll the result - You're exporting a deployable's configuration for promotion between instances
Required values
| Value | Description |
|---|---|
| Upload ID | Returned when you submit an upload; used to poll its status |
Example
package main
import (
"context"
"fmt"
"log"
servicenow "github.com/michaeldcanady/servicenow-sdk-go/v2"
"github.com/michaeldcanady/servicenow-sdk-go/v2/credentials"
)
func main() {
// Step 1: Authenticate and initialize the client
cred := credentials.NewBasicProvider("{username}", "{password}")
client, err := servicenow.NewServiceNowServiceClient(
servicenow.WithAuthenticationProvider(cred),
servicenow.WithInstance("{instance}"),
)
if err != nil {
log.Fatalf("failed to initialize client: %v", err)
}
ctx := context.Background()
applications := client.Cdm().Applications()
// Step 2: Check the status of a configuration upload
status, err := applications.UploadStatus().ByID("{SysID}").Get(ctx, nil)
if err != nil {
log.Fatalf("upload status failed: %v", err)
}
fmt.Printf("upload status: %+v\n", status)
// Step 3: List a deployable's exports
exports, err := applications.Deployables().Exports().Get(ctx, nil)
if err != nil {
log.Fatalf("exports failed: %v", err)
}
fmt.Printf("exports: %+v\n", exports)
}
Tips
- Uploads are asynchronous — always poll
UploadStatus()rather than assuming success. - Exports follow the same pattern: request via
Exports(), fetch content by ID.