code: func readingByDeviceHandler(w http.ResponseWriter, r *http.Request) {
  	defer r.Body.Close()
  
  	vars := mux.Vars(r)
  	limit, err := strconv.Atoi(vars["limit"])
  	// Problems converting limit to int
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusBadRequest)
  		LoggingClient.Error("Error converting the limit to an integer: " + err.Error())
  		return
  	}
  	deviceId, err := url.QueryUnescape(vars["deviceId"])
  	// Problems unescaping URL
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusBadRequest)
  		LoggingClient.Error("Error unescaping the device ID: " + err.Error())
  		return
  	}
  
  	ctx := r.Context()
  
  	switch r.Method {
  	case http.MethodGet:
  		err := checkMaxLimit(limit)
  		if err != nil {
  			http.Error(w, maxExceededString, http.StatusRequestEntityTooLarge)
  			return
  		}
  
  		readings, err := getReadingsByDevice(deviceId, limit, ctx)
  		if err != nil {
  			switch err := err.(type) {
  			case *types.ErrServiceClient:
  				http.Error(w, err.Error(), err.StatusCode)
  				return
  			default:
  				http.Error(w, err.Error(), http.StatusInternalServerError)
  				return
  			}
  		}
  
  		encode(readings, w)
  	}
  }
docs: // Get all the readings for the device - sort by creation date
  // 404 - device ID or name doesn't match
  // 413 - max count exceeded
  // api/v1/reading/device/{deviceId}/{limit}