suiteauth-go

command module
v0.0.0-...-afd3d84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

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)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL