Getting started¶
Welcome to the ServiceNow SDK for Go! This guide helps you set up the SDK and make your first successful API call in just a few minutes.
Prerequisites¶
Before you begin, make sure your development environment meets these requirements:
- Go: Version 1.23 or higher installed.
- ServiceNow Instance: Access to a ServiceNow instance (a Personal Developer Instance works).
Install the SDK¶
Add the SDK to your existing Go module using the go get command:
go get github.com/michaeldcanady/servicenow-sdk-go
Initialize the client¶
To interact with ServiceNow, you must first configure your credentials and initialize a client. The following example demonstrates a basic setup using username and password authentication.
import (
"log"
servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
"github.com/michaeldcanady/servicenow-sdk-go/credentials"
)
func main() {
// 1. Configure your credentials
credAdmin := credentials.NewBasicProvider("{username}", "{password}")
// 2. Initialize the client for your instance
clientPanic, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(credAdmin),
servicenowsdkgo.WithURL("https://{instance}.service-now.com"),
)
if err != nil {
panic(err)
}
}
Make your first request¶
Once you initialize your client, you can perform operations like retrieving records from a table. See the Table Operations guide for more details.
Next steps¶
Now that you have the basic setup, explore these topics to dive deeper:
- Authentication Guide: Learn about OAuth2 and alternative credential types.
- Table Operations: Master CRUD operations for ServiceNow records.
- Attachments: Manage files associated with your records.
- API Reference: Consult the detailed documentation for specific API modules.