When I’m calling /requesttoken (either via Python or Postman) I’m getting the following error message:
{"code":"REST-1101","error":true,"message":"The request cannot be processed: expected a JSON payload, but a query string was given.\nPlease visit https://docs.tigergraph.com/tigergraph-server/current/api/built-in-endpoints#_authentication for more information.","token":""}
Thanks for reporting this issue, actually we just made a release for the pyTigerGraph ( 0.0.9.8.8 ) to support the product change in 3.4+ ( requesttoken is POST )
Feel free to upgrade pyTigerGraph using
pip install -U pyTigerGraph
And for the PostMan calls please find below docs to explore the changes :
Hi @Mohamed_Zrouga ,
I am also facing the same issue. I tried updating pyTigerGraph as mentioned above but no luck. Any suggestions/roundabouts to make this work.
@Bruno Thanks a lot for the explanation!
as @Bruno mentioned: @mt_nagarro@gordonc you should use at least pyTigerGraph version 0.9.8.8, to support both token requests GET/POST ( TigerGraph 3.4+ )
Tried again without the setToken argument, but still encounter the same error.
code:
import json
import pyTigerGraph as tg
CONFIG = json.load(open('config.json'))
conn = tg.TigerGraphConnection(
host=CONFIG['host'],
graphname=CONFIG['graph_name'],
username=CONFIG['username'],
password=CONFIG['password']
)
# authToken = conn.getToken(CONFIG['api_secret']) # this way works
authToken = conn.getToken(conn.createSecret()) # this way does not work
Error message:
---------------------------------------------------------------------------
TigerGraphException Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_24412/1780925938.py in <module>
10 CONFIG['test_api_secret'] = conn.createSecret()
11
---> 12 authToken = conn.getToken(CONFIG['test_api_secret'])
~\miniconda3\envs\tg\lib\site-packages\pyTigerGraph\pyTigerGraph.py in getToken(self, secret, setToken, lifetime)
1413 if "Endpoint is not found from url = /requesttoken" in res["message"]:
1414 raise TigerGraphException("REST++ authentication is not enabled, can't generate token.", None)
-> 1415 raise TigerGraphException(res["message"], (res["code"] if "code" in res else None))
1416
1417 def refreshToken(self, secret, token=None, lifetime=2592000):
TigerGraphException: ('The request cannot be processed: expected a JSON payload, but a query string was given.\nPlease visit https://docs.tigergraph.com/tigergraph-server/current/api/built-in-endpoints#_authentication for more information.', 'REST-1101')