keolo / mixpanel_client

Ruby interface to the Mixpanel Data API
MIT License
148 stars 72 forks source link

Answers API "format" issue. #37

Closed jamiequint closed 9 years ago

jamiequint commented 10 years ago

When calling the Answers API ('engage/answers' endpoint) the API throws an error:

"Mixpanel::HTTPError: unknown param: format"

I can easily resolve this by monkey patching the Client class but it would be ideal if the API did not pass the format param on calls to the answers API. I will try to find time to fix this but wanted to post the issue here in the meantime in case others run into the same thing.

For calls to the answers api this is what I'm doing for now in my script.

module Mixpanel
  class Client
    def normalize_options(options)
      normalized_options = options.dup
      normalized_options
        .merge!(
          api_key: @api_key,
          expire: options[:expire] ? options[:expire].to_i : Time.now.to_i + 600
        ).merge!(
          sig: Utils.generate_signature(normalized_options, @api_secret)
        )
    end
  end
end
keolo commented 10 years ago

Interesting. That seems like a bug with the Mixpanel API. From their docs:

API endpoints Each type of analysis has its own endpoint and methods. Please note, the format parameter at this time is required and only supports json as a value at this time.

https://mixpanel.com/docs/api-documentation/data-export-api

I'd suggest raising this issue with them.

jamiequint commented 10 years ago

Cool, emailed our Mixpanel rep about the issue, will update this issue here if they let me know they have fixed this.

keolo commented 10 years ago

@jamiequint Any word on this?

keolo commented 9 years ago

Closing since I haven't heard anything.