Skip to content

how to get card data (with solution) #79

@igorkasyanchuk

Description

@igorkasyanchuk

Want to get card data. Found one solution. But want to ask if there is a proper way?

client = Metabase::Client.new(
  url: 'domain',
  token: "token"
)
client.current_user
# Sniffer.enable! for debugging gem
parameters = [{"type":"string/=","value":["SOME"],"target":["dimension",["template-tag","property"]]}.deep_stringify_keys]
client.query_card(4329, format: :json, parameters: parameters.to_json)

AND

in lib/metabase/connection.rb comment one line

    def connection
      @connection ||= Faraday.new(url: @url) do |c|
        c.response :logger, ::Logger.new(STDOUT), bodies: true
        # c.request :json, content_type: /\bjson$/
        c.response :json, content_type: /\bjson$/
        c.request :url_encoded, content_type: /x-www-form-urlencoded/
        c.adapter Faraday.default_adapter
        c.headers['User-Agent'] =
          "MetabaseRuby/#{VERSION} (#{RUBY_ENGINE}#{RUBY_VERSION})"
      end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions