List attachments
Overview
Returns the metadata for multiple attachments.
Path parameters
N/A
Optional query parameters
| Name | Type | Possible values | Description |
|---|---|---|---|
SysParmLimit | int | N/A | Maximum number of records to return. |
SysParmOffset | int | N/A | Starting record index for which to begin retrieving records. |
SysParmQuery | string | N/A | Encoded query used to filter the result set. |
Required query parameters
N/A
Examples
- Fluent
- Standard
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)
}
}
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)
}
// Step 3: Define raw URL
listRawURL := "https://{instance}.service-now.com/api/now/attachment"
// Step 4: Configure request
listStdConfig := &attachmentapi.AttachmentRequestBuilderGetRequestConfiguration{
// Optional configurations
}
// Step 5: Build request
listBuilder := attachmentapi.NewAttachmentRequestBuilder(listRawURL, client.GetRequestAdapter())
listStdResponse, err := listBuilder.Get(context.Background(), listStdConfig)
if err != nil {
log.Fatal(err)
}
}