@Physicsman and Forum
Good day everybody,
Together with Physicsman we were able to resolve the above issue.
Thanks again, Physicsman, for your assistance and determination in finding a solution.
For those of you who are attempting to log onto the API using python, please review the following code snippet and result.
NOTE language: python, platform: Google Colab
RECOMMENDATIONS:
1.) Call customer service to confirm two things:
1.) there are NO security locks for multiple failed attempts on the account you are trying to log onto
2.) confirm you account details (username, password, and AppKey). I discovered that the accounts team accidentally sent me the account number as the username.
But they were able to quickly correct this and provide me the correct username. So, make sure to confirm these details with customer service.
Once you have done these things, try using the code below:
Remember to substitute your credials for your specific account.
Code
import requests
import json
url = 'https://ciapi.cityindex.com/TradingAPI/session/'
data = {'Password':'XXXXXXX',
'UserName':'DM123456',
'AppKey':'ABC'
}
response = requests.post(url, json=data)
print(response.url)
print(response.status_code)
print(response.text)
Result:
Response 200 means successful connection.
From the response you can get your session id for other API functions
https://ciapi.cityindex.com/TradingAPI/session/
200 {"Session":"081ei2-awe234322-we23dr-223serrwd","PasswordChangeRequired":false,"AllowedAccountOperator":false,"StatusCode":1,"AdditionalInfo":null,"Is2FAEnabled":false,"TwoFAToken":null,"Additional2FAMethods":null,"UserType":1}