Go

Go - NewRequest

package main
​
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
​
func main() {
​
url := "https://pickyassist.com/app/api/v2/push"
​
payload := strings.NewReader("{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}")
​
req, _ := http.NewRequest("POST", url, payload)
​
req.Header.Add("content-type", "application/json")
​
res, _ := http.DefaultClient.Do(req)
​
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
​
fmt.Println(res)
fmt.Println(string(body))
​
}