Skip to main content
Version: v2.0

List attachments

Overview

Returns the metadata for multiple attachments.

Path parameters

N/A

Optional query parameters

NameTypePossible valuesDescription
SysParmLimitintN/AMaximum number of records to return.
SysParmOffsetintN/AStarting record index for which to begin retrieving records.
SysParmQuerystringN/AEncoded query used to filter the result set.

Required query parameters

N/A

Examples

package main

import (
"context"
"fmt"
"log"
"os"

servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go/v2"
attachmentapi "github.com/michaeldcanady/servicenow-sdk-go/v2/attachmentapi"
"github.com/michaeldcanady/servicenow-sdk-go/v2/credentials"
abstractions "github.com/microsoft/kiota-abstractions-go"
)

func main() {
// Step 1: Create credentials
cred := credentials.NewBasicProvider("{username}", "{password}")

// Step 2: Initialize client
client, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(cred),
servicenowsdkgo.WithURL("https://{instance}.service-now.com"),
)
if err != nil {
log.Fatal(err)
}

listConfig := &attachmentapi.AttachmentRequestBuilderGetRequestConfiguration{
// Optional configurations
}

listResponse, err := client.Now().Attachment().Get(context.Background(), listConfig)
if err != nil {
log.Fatal(err)
}
}
Was this page helpful?