func restGetYamlProfileById(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	id := vars[ID]

	// Check if the device profile exists
	op := device_profile.NewGetProfileID(id, dbClient)
	dp, err := op.Execute()
	if err != nil {
		if err == db.ErrNotFound {
			w.WriteHeader(http.StatusNotFound)
			w.Write([]byte(nil))
			return
		} else {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		LoggingClient.Error(err.Error())
		return
	}

	// Marshal the device profile into YAML
	out, err := yaml.Marshal(dp)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		LoggingClient.Error(err.Error())
		return
	}

	w.WriteHeader(http.StatusOK)
	w.Write(out)
}
/*
 * Implementation: https://groups.google.com/forum/#!topic/golang-nuts/EZHtFOXA8UE
 * Response:
 * 	- 200: database generated identifier for the new device profile
 *	- 400: YAML file is empty
 *	- 409: an associated command's name is a duplicate for the profile or if the name is determined to not be uniqe with regard to others
 * 	- 503: Server Error
 */
groups.google.com/forum/#!topic/golang-nuts/EZHtFOXA8UE
Response:
- 200: database generated identifier for the new device profile
- 400: YAML file is empty
- 409: an associated command's name is a duplicate for the profile or if the name is determined to not be uniqe with regard to others
- 503: Server Error
/ * * Implementation : https : // groups . google . com / forum / #!topic / golang - nuts / EZHtFOXA8UE * Response : * - 200 : database generated identifier for the new device profile * - 400 : YAML file is empty * - 409 : an associated command ' s name is a duplicate for the profile or if the name is determined to not be uniqe with regard to others * - 503 : Server Error * /
func restGetYamlProfileById(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	id := vars[ID]
	op := device_profile.NewGetProfileID(id, dbClient)
	dp, err := op.Execute()
	if err != nil {
		if err == db.ErrNotFound {
			w.WriteHeader(http.StatusNotFound)
			w.Write([]byte(nil))
			return
		} else {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		LoggingClient.Error(err.Error())
		return
	}
	out, err := yaml.Marshal(dp)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		LoggingClient.Error(err.Error())
		return
	}
	w.WriteHeader(http.StatusOK)
	w.Write(out)
}
func restGetYamlProfileById ( w http . ResponseWriter , r * http . Request ) { vars := mux . Vars ( r ) id := vars [ ID ] op := device_profile . NewGetProfileID ( id , dbClient ) dp , err := op . Execute ( ) if err != nil { if err == db . ErrNotFound { w . WriteHeader ( http . StatusNotFound ) w . Write ( [ ] byte ( nil ) ) return } else { http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) } LoggingClient . Error ( err . Error ( ) ) return } out , err := yaml . Marshal ( dp ) if err != nil { http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) LoggingClient . Error ( err . Error ( ) ) return } w . WriteHeader ( http . StatusOK ) w . Write ( out ) }
groups.google.com/forum/#!topic/golang-nuts/EZHtFOXA8UE
Response:
 200: database generated identifier for the new device profile
 400: YAML file is empty
 409: an associated command's name is a duplicate for the profile or if the name is determined to not be uniqe with regard to others
 503: Server Error
groups . google . com / forum / #!topic / golang - nuts / EZHtFOXA8UE Response : 200 : database generated identifier for the new device profile 400 : YAML file is empty 409 : an associated command ' s name is a duplicate for the profile or if the name is determined to not be uniqe with regard to others 503 : Server Error
// Check if the device profile exists // Marshal the device profile into YAML