taylorbrooks / closeio

A Ruby wrapper for the Close.io API
http://developer.close.com
MIT License
45 stars 57 forks source link

get request return plain html #50

Closed alexey closed 5 years ago

alexey commented 6 years ago

lead_info = closeio_client.get('lead', query: recipient)

Return me plain html :/ Tried the same query with postman and it looks ok..

https://app.close.io/api/v1/lead?query=recipient%3Aran%40test.com

Do you have idea ? (other queries in same session are working)

I, [2018-05-31T12:16:29.092320 #56528]  INFO -- : get https://app.close.io/api/v1/lead?query=recipient%3Aran%40test.com
D, [2018-05-31T12:16:29.092550 #56528] DEBUG -- request: Accept: "application/json"
User-Agent: "closeio-ruby-gem/v3.0.1"
X-TZ-Offset: "0"
Authorization: "Basic Njg1ODdjODBkMWE4MTk3MmFmZWU2MjJjZjBmM2ExOWU1MmU3NjQyMDQ5Mzc0ZGI0YTRmZDlmYjQ6"
Faraday::ParsingError: 765: unexpected token at '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="https://app.close.io/api/v1/lead/?query=recipient%3Aran%40test.com">https://app.close.io/api/v1/lead/?query=recipient%3Aran%40test.com</a>
taylorbrooks commented 6 years ago

Try calling it like this:

lead_info = closeio_client.list_leads('recipient:ran@test.com')
# or this:
lead_info = closeio_client.list_leads(recipient: 'ran@test.com')
taylorbrooks commented 5 years ago

@alexey Is this still an issue?

alexey commented 5 years ago

@taylorbrooks hi ! not anymore, as i remember your example solved me the issue, sorry forgot to update