bambou/session.go
func (s *Session) SaveEntity(object Identifiable) *Error {

	url, berr := s.getPersonalURL(object)
	if berr != nil {
		return berr
	}

	buffer := &bytes.Buffer{}
	if err := json.NewEncoder(buffer).Encode(object); err != nil {
		return NewBambouError("JSON error", err.Error())
	}

	url = url + "?responseChoice=1"
	request, err := http.NewRequest("PUT", url, buffer)
	if err != nil {
		return NewBambouError("HTTP transaction error", err.Error())
	}

	response, berr := s.send(request, nil)
	if berr != nil {
		return berr
	}
	defer response.Body.Close()

	body, _ := ioutil.ReadAll(response.Body)
	log.Debugf("Response Body: %s", string(body))

	dest := IdentifiablesList{object}
	if len(body) > 0 {
		if err := json.Unmarshal(body, &dest); err != nil {
			return NewBambouError("JSON Unmarshaling error", err.Error())
		}
	}

	return nil
}
func (s *Session) SaveEntity(object Identifiable) *Error {

	url, berr := s.getPersonalURL(object)
	if berr != nil {
		return berr
	}

	buffer := &bytes.Buffer{}
	if err := json.NewEncoder(buffer).Encode(object); err != nil {
		return NewBambouError("JSON error", err.Error())
	}

	url = url + "?responseChoice=1"
	request, err := http.NewRequest("PUT", url, buffer)
	if err != nil {
		return NewBambouError("HTTP transaction error", err.Error())
	}

	response, berr := s.send(request, nil)
	if berr != nil {
		return berr
	}
	defer response.Body.Close()

	body, _ := ioutil.ReadAll(response.Body)
	log.Debugf("Response Body: %s", string(body))

	dest := IdentifiablesList{object}
	if len(body) > 0 {
		if err := json.Unmarshal(body, &dest); err != nil {
			return NewBambouError("JSON Unmarshaling error", err.Error())
		}
	}

	return nil
}
// SaveEntity saves the given Identifiable into the server.