Raja Ongkir's Website (https://rajaongkir.com)
go get github.com/Bhinneka/go-rajaongkir
-
Get Cost Data
package main import ( "fmt" "time" "github.com/Bhinneka/go-rajaongkir" ) func main() { // Raja Ongkir Constructor, simply call ro.New // Parameter 1: "Raja Ongkir API KEY" // Parameter 2: HTTP Request Timeout raja := ro.New("your-api-key", 10*time.Second) //by default after construct, raja ongkir used Starter Env(Free account) //to change Env, simply just change the env //raja.Env = ro.Basic for basic account //or raja.Env = ro.Pro for pro account // Parameter 1: City Origin ID // Parameter 2: City Destination ID // Parameter 3: Item's Weight // Parameter 4: Courier's Name q := ro.QueryRequest{Origin: "501", Destination: "114", Weight: 1700, Courier: "tiki"} result := raja.GetCost(q) if result.Error != nil { fmt.Println(result.Error.Error()) } cost, ok := result.Result.(ro.Cost) if !ok { fmt.Println("Result is not Cost") } fmt.Println(cost) }
- Create Service for Starter(Free Account)
- Create Service for Basic and Pro Raja Ongkir Account
- Create Unit Testing
- Integration with Travis CI
- Lone Wolf (https://github.com/wuriyanto48)