I am trying to authenticate / login with the GoodData API but I am having trouble. On the GoodData API documentation site (docs.gooddata.apiary.io) it says to POST to:
URL:
https://secure.gooddata.com/gdc/account/login
Headers:
Accept: application/json Content-Type: application/json
JSON Body:
{"postUserLogin":{"login":"[email protected]","password":"YourPassword","remember":1}}
I get the response "Private API, please provide private hash." Any ideas?
The updated GoodData API documentation and API console is located at https://developer.gooddata.com/api
The login URL for this call is actually https://secure.gooddata.com/gdc/account/login
Using the same payload (your credentials instead of sample) you will be able to login and get the SST Token that is returned back in SetCookie header.
Please remember the process to login is:
Also, please remember that TT Token has limited validity. Once you received 401 Unauthorized Response, you need to GET new TT Token in following resource with SST Token specified in call header.
or you can use python and code should look like following
jirka@x230:~$ python
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib2 import Request, urlopen
>>> from json import dumps
>>> values = dumps({"postUserLogin":{"login":"[email protected]","password":"secredpassword","remember":1}})
>>> headers = {"Accept": "application/json", "Content-Type": "application/json"}
>>> request = Request("https://secure.gooddata.com/gdc/account/login", data=values, headers=headers)
>>> response_body = urlopen(request)
>>> print response_body.read()
{"userLogin":{"profile":"/gdc/account/profile/254c399a3f5131b7026313d4f8761410","state":"/gdc/account/login/254c399a3f5131b7026313d4f8761410"}}
>>> print response_body.info()
X-GDC-REQUEST: FnETpOmoAPELJoS1
Server: Apache
Set-Cookie: GDCAuthTT=; path=/gdc; expires=Wed, 08-Jan-2014 20:07:00 GMT; secure; HttpOnly
Set-Cookie: GDCAuthSST=QubuMlx3byz6lta1; path=/gdc/account; expires=Sun, 23-Feb-2014 20:07:00 GMT; secure; HttpOnly
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Pragma: no-cache
P3P: CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'
X-GDC-LOG-HEADER:
X-GDC-REQUEST-TIME: 53
Content-Type: application/json;charset=UTF-8
Content-Length: 143
Accept-Ranges: bytes
Date: Fri, 07 Feb 2014 20:07:00 GMT
X-Varnish: 1076092393
Age: 0
Via: 1.1 varnish
Connection: close
>>> headers = {"Cookie": "$Version=0; GDCAuthSST=QubuMlx3byz6lta1; $Path=/gdc/account", "Accept": "application/json", "Content-Type": "application/json"}
>>> request = Request("https://secure.gooddata.com/gdc/account/token", headers=headers)
>>> response_body = urlopen(request)
>>> print response_body.read()
{}
>>> print response_body.info()
X-GDC-REQUEST: IyuefQK4mMIm4Vqr
Server: Apache
Set-Cookie: GDCAuthTT=VL_Bum5jjd8cEtFUa6XF5tfVmmiFDn7ZyB6a95kEuhzlQw-D67RIL_8u1E9e_z3yDx2bgHrsVNwX6zY1XRzsVpgtvC7HY2JBWiTtq63_Y-XxQwN9cO9RJO6GwM8WnshREwXXgzUk0vr9U4Gg-a4FnEs5NR4ySWOW1bhjnFSJFG17ImwiOiIwIiwidSI6IjE3Mzk4NyIsImsiOiIxYTZiNzc4ZC0yNDkyLTQ2OWEtODliYy1lNWQ1OWU1ODAyNDUiLCJ1aWQiOiIyNTRjMzk5YTNmNTEzMWI3MDI2MzEzZDRmODc2MTQxMCIsInYiOjEzOTE4MDQzMjV9; path=/gdc; secure; HttpOnly
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Pragma: no-cache
P3P: CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'
X-GDC-TIMESTAMP: 600
X-GDC-LOG-HEADER:
X-GDC-REQUEST-TIME: 30
Content-Type: application/json;charset=UTF-8
Content-Length: 2
Accept-Ranges: bytes
Date: Fri, 07 Feb 2014 20:08:45 GMT
X-Varnish: 1076094531
Age: 0
Via: 1.1 varnish
Connection: close
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With