Skip to content

List attachments

Overview

Returns the metadata for multiple attachments.

Path parameters

Name Description
baseurl The absolute base URI for the request (this is the same for all requests) including: the schema, the domain, and a path fragment.

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

package main


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

    servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
    attachmentapi "github.com/michaeldcanady/servicenow-sdk-go/attachment-api"
    "github.com/michaeldcanady/servicenow-sdk-go/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)
    }



    list_config := &attachmentapi.AttachmentRequestBuilder2GetRequestConfiguration{
        // Optional configurations
    }

    list_response, err := client.Now2().Attachment2().Get(context.Background(), list_config)
    if err != nil {
        log.Fatal(err)
    }

}
package main


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

    servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
    attachmentapi "github.com/michaeldcanady/servicenow-sdk-go/attachment-api"
    "github.com/michaeldcanady/servicenow-sdk-go/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
    list_rawURL := "https://https://{instance}.service-now.com/api/now/attachment"

    // Step 4: Configure request
    list_std_config := &attachmentapi.AttachmentRequestBuilder2GetRequestConfiguration{
        // Optional configurations
    }

    // Step 5: Build request
    list_builder := attachmentapi.NewAttachmentRequestBuilder2(list_rawURL, client.RequestAdapter)

    list_std_response, err := list_builder.Get(context.Background(), list_std_config)
    if err != nil {
        log.Fatal(err)
    }

}