Download Filings through RDP with RWS license?
Hi all,
I am asking this question even though I think I already know the answer, but I just want to look for confirmation and similar experiences from your side.
I am interested in downloading Global Filings documents that I already found in Workspace. I can download them manually there, e.g. BASFn.DE -> go to Filings tab and then download e.g. the pdf of "BASF Report 2022 (BASF Group)" (document title) dated 24-Feb-2023 (fill date).
I don't want to download the documents manually in Workspace, but use an API solution.
I found this nice introductory article Introduction To Filings - Python | Devportal (refinitiv.com) and tried to run the code there. I have reproduced the code in the attached file in a slightly more compressed form:
# import packages
import requests, json, time, os
# set credentials
USERNAME = ""
PASSWORD = ""
CLIENT_ID = ""
# Set Application Constants
RDP_AUTH_VERSION = "/v1"
RDP_FILINGS_VERSION = "/beta1"
RDP_BASE_URL = "https://api.refinitiv.com"
CATEGORY_URL = "/auth/oauth2"
ENDPOINT_URL = "/token"
CLIENT_SECRET = ""
TOKEN_FILE = "token.txt"
SCOPE = "trapi"
# generate access and refresh token
TOKEN_ENDPOINT = RDP_BASE_URL + CATEGORY_URL + RDP_AUTH_VERSION + ENDPOINT_URL
def _requestNewToken(refreshToken):
if refreshToken is None:
tData = {
"username": USERNAME,
"password": PASSWORD,
"grant_type": "password",
"scope": SCOPE,
"takeExclusiveSignOnControl": "true"
};
else:
tData = {
"refresh_token": refreshToken,
"grant_type": "refresh_token",
};
## Make a REST call to get latest access token
response = requests.post(
TOKEN_ENDPOINT,
headers = {
"Accept": "application/json"
},
data = tData,
auth = (
CLIENT_ID,
CLIENT_SECRET
)
)
if response.status_code != 200:
raise Exception("Failed to get access token {0} - {1}".format(response.status_code, response.text));
## Return the new token
return json.loads(response.text);
def saveToken(tknObject):
tf = open(TOKEN_FILE, "w+");
print("Saving the new token");
## Append the expiry time to token
tknObject["expiry_tm"] = time.time() + int(tknObject["expires_in"]) - 10;
## Store it in the file
json.dump(tknObject, tf, indent=4)
def getToken():
try:
print("Reading the token from: " + TOKEN_FILE);
## Read the token from a file
tf = open(TOKEN_FILE, "r+")
tknObject = json.load(tf);
## Is access token valid
if tknObject["expiry_tm"] > time.time():
# return access token
#print(tknObject["expiry_tm"])
#print("time.time()="+ str(time.time()))
return tknObject["access_token"];
print("Token expired, refreshing a new one...");
tf.close();
## Get a new token from refresh token
tknObject = _requestNewToken(tknObject["refresh_token"]);
except Exception as exp:
print("Caught exception: " + str(exp))
print("Getting a new token using Password Grant...");
tknObject = _requestNewToken(None);
## Persist this token for future queries
saveToken(tknObject)
## Return access token
return tknObject["access_token"]
accessToken = getToken()
print("Have token now")
#print("Token is: " + accessToken)
# document retrieval
## some document
retrievalParameters = "docId/54932207"
## endpoint
ENDPOINT_DOC_RETRIEVAL = RDP_BASE_URL + '/data/filings' + RDP_FILINGS_VERSION + '/retrieval/search/' + retrievalParameters
## headers
headers = {
"Authorization": "Bearer " + accessToken,
"X-API-Key": "155d9dbf-f0ac-46d9-8b77-f7f6dcd238f8",
"ClientID" : "api_playground"
}
# request
print("Next we retrieve: " + ENDPOINT_DOC_RETRIEVAL);
response = requests.get(ENDPOINT_DOC_RETRIEVAL, headers = headers);
print("Response status code = "+str(response.status_code))
print("Response text = ", json.dumps(json.loads(response.text), indent=4))
I get the following error message:
Response text = {
"error": {
"code": "insufficient_scope",
"message": "access denied. Scopes required to access the resource: [trapi.data.filings.retrieval]. Missing scopes: [trapi.data.filings.retrieval]",
"status": "Forbidden"
}
This scope [trapi.data.filings.retrieval] is also not listed here https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/tutorials#authorization-all-about-tokens, So I assume that the Filings API is an additional service that you have to subscribe to and is not included in a Workspace license.
I also found in the README of another example code https://github.com/Refinitiv-API-Samples/Article.RD.Python.PredictiveModellingForFilings that I need
- A Refinitiv Data Platform (RDP) license with access to the Filings data services
To summarize:
- Filings cannot be downloaded via an API solution with an RWS (Refinitiv Workspace for Students) license. Right?
- Can you also explain to me what this is (the header arguments of ENDPOINT_DOC_RETRIEVAL in the document retrieval endpoint; see code):
- "X-API-Key": "155d9dbf-f0ac-46d9-8b77-f7f6dcd238f8",
- "ClientID" : "api_playground"
Many thanks
Philip
Best Answer
-
Hi @schwedler ,
I'm sorry to hear that you're having this issue. I found the ticket you created for the support team on the same issue then I'm reaching out to the support team to check the entitlement on your account and the further action because this is not an issue with your code to call the API as you can get the response from the API properly. We will keep you updated.
Hope this helps and please let me know in case you have any further questions.
0
Answers
-
Thank you for contacting me. The support team has forwarded me to the developer community. I hope you will be able to find out more.
I am looking forward to your response.
0 -
Thanks for pushing this request to my account manager. Indeed this request needs additional licensing. With a Workspace license you can only use the Bulk Download option via the Batch Print/Save App (needs an additional installation) to download multiple reports at the same time.
All the best!
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛