code: func (h *Handler) handleGetFragmentBlocks(w http.ResponseWriter, r *http.Request) {
  	if !validHeaderAcceptJSON(r.Header) {
  		http.Error(w, "JSON only acceptable response", http.StatusNotAcceptable)
  		return
  	}
  	// Read shard parameter.
  	q := r.URL.Query()
  	shard, err := strconv.ParseUint(q.Get("shard"), 10, 64)
  	if err != nil {
  		http.Error(w, "shard required", http.StatusBadRequest)
  		return
  	}
  
  	blocks, err := h.api.FragmentBlocks(r.Context(), q.Get("index"), q.Get("field"), q.Get("view"), shard)
  	if err != nil {
  		if errors.Cause(err) == pilosa.ErrFragmentNotFound {
  			http.Error(w, err.Error(), http.StatusNotFound)
  		} else {
  			http.Error(w, err.Error(), http.StatusInternalServerError)
  		}
  		return
  	}
  
  	// Encode response.
  	if err := json.NewEncoder(w).Encode(getFragmentBlocksResponse{
  		Blocks: blocks,
  	}); err != nil {
  		h.logger.Printf("block response encoding error: %s", err)
  	}
  }
docs: // handleGetFragmentBlocks handles GET /internal/fragment/blocks requests.