Dear All,
This article is intended for SAP Commissions developers can make us of Golang programming using restAPI to scale up the faster response for any development.
GO is one of the awesome programming languages nowadays. GO is the simple and fastest language, even GO is fastest from Java and Python. GO doing very well at web. GO is easy to learn. If you are familiar with any programming language then you can learn it so fast.
Go is compiled to machine code, it will naturally outperform languages that are interpreted or have virtual runtimes. Go programs also compile extremely fast, and the resulting binary is very small.
Golang can boast speeds of close to four times quicker than its interpreted and dynamic friends. That said, very little can touch C++ (and most C languages) when it comes to speed. All of the time spent coding and compiling pays off here
you can find lot much of Golang topics and why its essential skill to learn for your future programming
Using SAP Commissions RestAPI , you can make a call to get fast response and scale up to speed to integrate with SAP BTP using Cloud foundry with Kyma serverless function.
Sample code for calling SAP Commissions Rest API using GO
package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
"strings"
)
// HTTP basic authentication example in Golang using the RTC Server RESTful API
func main() {
// Customer ID
username := "userid"
// Customer secret
password := "Pssw0rd1"
// Concatenate customer key and customer secret and use base64 to encode the concatenated string
plainCredentials := username + ":" + password
base64Credentials := base64.StdEncoding.EncodeToString([]byte(plainCredentials))
url := "https://<tenantid>.callidusondemand.com/api/v2/creditTypes"
method := "GET"
payload := strings.NewReader(``)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
// Add Authorization header
req.Header.Add("Authorization", "Basic "+base64Credentials)
req.Header.Add("Content-Type", "application/json")
// Send HTTP request
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
References :
Go Installation Link
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
11 | |
6 | |
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 |