# File lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb, line 28
      def delete(request)
        begin
          doomed_cookbook_json = get_data(request)
          identified_cookbook_data = normalize(request, parse_json(doomed_cookbook_json))
          delete_data(request)

          # go through the recipes and delete stuff in the file store.
          hoover_unused_checksums(get_checksums(doomed_cookbook_json), request)

          # if this was the last revision, delete the directory so future requests will 404, instead of
          # returning 200 with an empty list.
          # Last one out turns out the lights: delete /organizations/ORG/cookbooks/COOKBOOK if it no longer has versions
          cookbook_path = request.rest_path[0..3]
          if exists_data_dir?(request, cookbook_path) && list_data(request, cookbook_path).size == 0
            delete_data_dir(request, cookbook_path)
          end

          json_response(200, identified_cookbook_data)
        rescue RestErrorResponse => ex
          if ex.response_code == 404
            error(404, "not_found")
          else
            raise
          end
        end
      end