I am trying to go from ticker + exchange mic code to Refinitive RIC and permID. I am using the permID API entity search functionality. I can successfully use the requests.get method to obtain such information for one ticker but when I try to use requests.post to send bulk requests I receive a 401 message back. The piece of code that is succesfully getting back an individual entry info is the following:
import requests
import json
import pandas as pd
import pprint
# Your own access token
access_token = 'XXXX' # XXXX has been replaced with my private API token
q_1 = 'ticker:SAP AND mic:XETR'
# API endpoint
request_url = " https://api-eit.refinitiv.com/permid/search"
headers = {
'q': q_1,
'access-token': access_token
}
response = requests.get(request_url, params=headers)
print(response)
r = response.json()
The piece of code which is howerver returning an authentication error is the following:
import requests
import json
import pandas as pd
import pprint
# Your own access token
access_token = 'XXXX' # XXXX has been replaced with my private API token
q_1 = 'ticker:SAP AND mic:XETR'
q_2 = 'ticker:ADS AND mic:XETR'
# API endpoint
request_url = " https://api-eit.refinitiv.com/permid/search"
data = {
'q': [q_1, q_2],
'access-token': access_token
}
response_post = requests.post(request_url, data=data)
print(response_post)
r = response_post.json()
Can you please confirm whether:
a) it is possible to request.posts in bulk as I am attempting to do?
b) why I am getting this error message back?
c) how I can fix my code to obtain a positive output?
I have ±500 tickers to request programmatically and I would like to do that by splitting my HTTPS requests in bulks of 50 each if possible.
Thanks you.