Example #1
0
func (g *Groups) CreateGroup(group Group) []util.ApiResponse {
	url := fmt.Sprintf(get_groups_url, g.Hostname, g.Username)
	group_json, _ := json.Marshal(&group)
	data := string(group_json)
	response := util.HttpPost(url, data, "application/json")
	var api_response []util.ApiResponse
	json.Unmarshal(response, &api_response)
	return api_response
}
Example #2
0
func (cc *Configuration) CreateUser(username string, device_type string) []util.ApiResponse {
	username_md5 := util.CreateMd5Hash(username)
	api_data := User{username_md5, device_type}
	json_data, _ := json.Marshal(api_data)
	url := fmt.Sprintf(create_username_url, cc.Hostname)
	response := util.HttpPost(url, string(json_data), "application/json")
	var api_response []util.ApiResponse
	json.Unmarshal(response, &api_response)
	return api_response
}