I'm currently trying to send a get request in HTTParty that logs in and gets some API data. I've successfully done this via curl by doing:
curl -v --user USERNAMEHERE:PassWordHere http://ift.tt/1SUfi7t
This outputs in my console:
➜ HeatWatch git:(kunzig_new_heatwatch) ✗ curl -v --user (userOmitted):(password_omitted) http://ift.tt/1SUfi7t
* Hostname was NOT found in DNS cache
* Trying 23.92.23.58...
* Connected to app.ionitnetworks.com (23.92.23.58) port 80 (#0)
* Server auth using Basic with user 'userOmitted'
> GET /ionit-app/api/rest/v1/devices HTTP/1.1
> Authorization: Basic ZG91Z0dofW301320Y2AsayZlLmNvbTpkb3VnMTIz
> User-Agent: curl/7.35.0
> Host: app.ionitnetworks.com
> Accept: */*
I've tried a bunch of stuff to get this to work in httparty but nothing has worked such as:
@response = HTTParty.post("http://ift.tt/1SUffZl", :headers =>{ "Authorization" =>"Token token=\"AccountsTokenOmitted\"" })
Any tips would be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire