1
$\begingroup$

I have started using IBM's Q Experience and I am trying to obtain an access token in order to communicate with the REST API. I understand that I can use my API token to obtain authorization by sending an html post request to the API but I keep getting an error. Attached is the code I am using as well as the output. I apologize if this is a simple syntax related issue by I can't seem to get around it. Thank you for your help.

Code:

import requests
import pprint

api_token = 'api token goes here'

r = requests.post(url = 'https://quantumexperience.ng.bluemix.net/api/users/loginWithToken'
                  params = {'apiToken': '{}'.format(api_token)})

r.json()

Output:

{'error': {'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}}
$\endgroup$
  • 1
    $\begingroup$ Thanks for your question. As a quick not-quite-an-answer, here's some code that definitely worked a few months ago github.com/quantumjim/qreative/blob/master/tutorials/… $\endgroup$ – James Wootton Jun 21 at 7:51
  • $\begingroup$ @JamesWootton thanks for your response. Didn't fix the issue but seems to be a step in the right direction! It is now saying that I need to accept the license to the web platform and redirects me to this link quantumexperience.ng.bluemix.net which is the end user agreement but there is no way to accept it. $\endgroup$ – Peter Salamon Jun 21 at 11:32
  • $\begingroup$ Have you tried signing in at quantum-computing.ibm.com instead. That should give you the prompt to accept $\endgroup$ – James Wootton Jun 21 at 15:55
  • $\begingroup$ I have, but no luck. I think I'll have to revisit this issue at a later time. I don't believe that it will affect my ability to access the full capabilities of Qiskit. I was simply trying to obtain information on the backends available through the IBM Q Experience using a REST API call. $\endgroup$ – Peter Salamon Jun 23 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.