Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
/ gosnow Public archive

Golang wrapper for the Servicenow REST API

License

Notifications You must be signed in to change notification settings

michaeldcanady/gosnow

Repository files navigation

gosnow

GitHub go.mod Go version GitHub Workflow Status GoDoc GitHub release (latest by date) GitHub issues GitHub GitHub all releases

DEPRECATION NOTICE: This module has been deprecated in favor of servicenow-sdk-go

Table of Contents

Current Ideas:

  • Remove need for "resource"
  • Build out Tables API

GoSnow is a Golang wrapper for the Service Now API.

Installation

go get github.com/michaeldcanady/gosnow

Usage

import "github.com/michaeldcanady/gosnow/v6/gosnow"

Examples

Getting a table value

package main

import(
    "fmt"

    "github.com/michaeldcanady/gosnow/v6/gosnow"
)

client, _ := gosnow.New(username, password, instance)
CSTable, _ := client.Table("TableName")
query := map[string]interface{}{"field": "value"}
respose, _ := CSTable.Get(query, 0, 0, true, nil)
fmt.Println(respose.First())

Update a table value

package main

import(
    "fmt"

    "github.com/michaeldcanady/gosnow/v6/gosnow"
)

client, _ := gosnow.New(username, password, instance)
CSTable, _ := client.Table("TableName")

// map of values to update
query := map[string]interface{}{"field": "value"}

respose, _ := CSTable.Update(query, 1, 0, true, nil)

Delete a table value

query := map[string]interface{}{"field": "value"}
respose, _ := CSTable.Delete(query)

Create a table value

package main

import(
    "fmt"

    "github.com/michaeldcanady/gosnow/v6/gosnow"
)

client, _ := gosnow.New(username, password, instance)

CSTable, _ := client.Table("TableName")

query := map[string]interface{}{}

respose, _ := CSTable.Create(query)

Contributing

See CONTRIBUTORS.md for details.

Author

Michael Canady