func UpdateUserDictionaryEntry(basePath string) {
apiURL := "/api/v1/user/TEST/dictionary/12"
requestJson := &UserDictionaryEntry{
FromLang: "en",
FromText: "square",
ToLang: "jp",
ToText: "二乗"}
jsonValue, _ := json.Marshal(requestJson)
client := &http.Client{}
req, err := http.NewRequest(
"PUT",
GetFullUrl(basePath, apiURL),
bytes.NewBuffer([]byte(jsonValue)),
)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("accessUser", "TEST")
res, err := client.Do(req)
if err != nil {
fmt.Printf("The HTTP request failed with error %s\n", err)
} else {
data, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(data))
}
}