Hello ,
I am working on setting up a python downloader for “On Demand Raw Data Extraction” using the documentation provided here (https://developers.refinitiv.com/en/api-catalog/refinitiv-tick-history/refinitiv-tick-history-rth-rest-api/tutorials#rest-api-tutorial-8-on-demand-raw-data-extraction)
I’m running into an issue where I get a 400(Bad Request) response. See below for details
On Demand Extraction Request Url : https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractRaw
Python Function
baseUrl = "https://selectapi.datascope.refinitiv.com/RestApi/v1/"
requestHeaders = { "Prefer":"respond-async", "Content-Type":"application/json" }
# Get Location URL
defgetLocationUrl( token):
ExtractionUrl = baseUrl + "Extractions/ExtractRaw"
requestHeaders["Authorization"] = "token " + token
params = { "ExtractionRequest": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest", "IdentifierList": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", "InstrumentIdentifiers": [ { "Identifier" : "AB.PS" , "IdentifierType" : "Ric" } ] }, "Condition": { "ReportDateRangeType": "Delta", "DaysAgo": 1 } } }
print(ExtractionUrl)
r = requests.post( ExtractionUrl, headers=requestHeaders , params=params)
if (r.status_code==200):
print ("YAY")
else:
print(r.status_code)
print(r.reason )
print(r.text)
Response Code
r.status.code = 400
r.reason = ‘Bad Request’
r.text = {"error":{"code":"6fe04886-854a-45d5-bc57-4d6ab225a700","message":"Query option 'ExtractionRequest' was specified more than once, but it must be specified at most once."}}
Per the Response message , ‘ExtractionRequest’ was specified more than once, but as you can see in the below, It was only specified once
params = { "ExtractionRequest": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest", "IdentifierList": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", "InstrumentIdentifiers": [ { "Identifier" : "AB.PS" , "IdentifierType" : "Ric" } ] }, "Condition": { "ReportDateRangeType": "Delta", "DaysAgo": 1 } } }
Can someone please look into this and help us out with resolving this issue.
Thanks,
Naveen.