bambou/session.go
func (s *Session) CreateChild(parent Identifiable, child Identifiable) *Error {

	url, berr := s.getURLForChildrenIdentity(parent, child.Identity())
	if berr != nil {
		return berr
	}

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

	request, err := http.NewRequest("POST", 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{child}
	if err := json.Unmarshal(body, &dest); err != nil {
		return NewBambouError("JSON Unmarshaling error", err.Error())
	}

	return nil
}
func (s *Session) CreateChild(parent Identifiable, child Identifiable) *Error {

	url, berr := s.getURLForChildrenIdentity(parent, child.Identity())
	if berr != nil {
		return berr
	}

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

	request, err := http.NewRequest("POST", 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{child}
	if err := json.Unmarshal(body, &dest); err != nil {
		return NewBambouError("JSON Unmarshaling error", err.Error())
	}

	return nil
}
// CreateChild creates a new child Identifiable under the given parent Identifiable in the server.