Skip to content

Generate Authentication headers for NetSuite SOAP/REST requests

License

Notifications You must be signed in to change notification settings

felipechang/suiteauth-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SuiteAuth-Go

Generate Authentication headers for NetSuite SOAP/REST requests

Usage:

package main

import (
    "github.com/felipechang/suiteauth-go/auth"
    "log"
)

func main() {

    p := auth.NewHeader(&auth.HeaderOptions{
        AccountId:      "1234567-sb1",
        ConsumerKey:    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        ConsumerSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        TokenId:        "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        TokenSecret:    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    })

    soapUri := p.GetSoapApiBaseUri("2021_1")
    soapHeader := p.GetSoapApiAuthHeader("2021_1")

    output, err := xml.MarshalIndent(soapHeader, "  ", "    ")
    if err != nil {
        log.Fatalln(err)
    }

    log.Printf("auth soapUri: %s", soapUri)
    log.Printf("auth soapHeader: %s", string(output))

    restUri := p.GetRestApiBaseUri()
    restHeader := p.GetRestApiAuthHeader("GET", restUri)
    log.Printf("auth restUri: %s", restUri)
    log.Printf("auth restHeader: %s", restHeader)
}

About

Generate Authentication headers for NetSuite SOAP/REST requests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages