Closed chris19960730 closed 4 years ago
Works well for me:
client = IEX::Api::Client.new
logo = client.logo('AAPL')
logo.url # "https://storage.googleapis.com/iexcloud-hl37opg/api/logos/AAPL.png"
Maybe it's a problem with specific company. What ticker do you use?
I tested several companies like 'AAPL', 'GOOG', 'MSFT'. All the URL I got is encoded like below:
By the way, My IEX account is in a free plan, is that limit me to access the logo?
Thanks!
Sorry for the delay. I checked it with my free public token and it works well. Looks like something in your project substitutes the response or breaks JSON parsing. You can try to do the same manually to find the step where it breaks.
# bash
curl "https://cloud.iexapis.com/v1/stock/msft/logo?token=your_token_here"
# ruby console
Faraday.get('https://cloud.iexapis.com/v1/stock/msft/logo', token: 'your_token').body
JSON.parse('{"url":"https://storage.googleapis.com/iexcloud-hl37opg/api/logos/MSFT.png"}')
@chris19960730 If you have a repro for us we can take a look! Closing otherwise for now.
This happens because you're running against IEX sandbox and that is the data returned from the API. According to that doc:
Data returned from sandbox API calls is scrambled and should not be used for purposes outside of testing. However, test calls return the same properties and data types as they will in production, which allows for full functionality testing.
Many endpoints that return a date — such as Historical Prices — will have the date accurately returned in the sandbox environment, so as to allow users to test out charting functionality within their application or project.
I'm going to stop recommending the sandbox environment as the default in the README, it confuses new users, https://github.com/dblock/iex-ruby-client/pull/75.
Hi, I am trying to get the company's logo image address using client.logo("name").url. However, the result seems like encoded string, not the example shown as https://storage.googleapis.com/iex/api/logos/XXXX
Here is the rails console trying to get the logo of Apple.
Can you help me with that? Much thanks!