Client si not getting the data as expeted with the given API

Narasimha_Prasad
edited May 29 in DSS

I tried using it but it doesn't seem to work for me as i believe i have not entered the details accurately , please find below the request header along with the body and url and please let me know if it looks accurate for a scheduled request to extract price data

[For getting token and header]

token_url = "https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken"

payload = "{\r\n \"Credentials\": {\r\n \"Username\": \"9038135\",\r\n \"Password\": \"********\"\r\n }\r\n}"

scheduled_price_url="https://selectapi.datascope.refinitiv.com/restapi/v1/Extractions/Schedules"

response = requests.request("POST", token_url, headers=headers, data=payload,proxies = PROXY,verify=False)

print("Successfully connected")

data=response.json()

token=data.get("value")

scheduled_price_header={

'Prefer': 'respond-async',

'Content-Type': 'application/json',

"Authorization": "Token "+token

}

PROXY = {

'http':'http://proxy.jpmchase.net:10443'

, 'https':'http://proxy.jpmchase.net:10443'

}

[Body and Scheduled Price history extraction]

response = requests.request("POST", token_url, headers=headers, data=payload,proxies = PROXY,verify=False)

print("Successfully connected")

data=response.json()

token=data.get("value")

scheduled_price_header={

'Prefer': 'respond-async',

'Content-Type': 'application/json',

"Authorization": "Token "+token

}

body={

"Name": "TEST Sample EOD Extraction",

"TimeZone": "Coordinated Universal Time",

"Recurrence":

{

"@odata.type": "#DataScope.Select.Api.Extractions.Schedules.SingleRecurrence",

"ExtractionDateTime": "2024-10-21T12:35:00.000",

"IsImmediate": "TRUE"

},

"Trigger":

{

"@odata.type": "#DataScope.Select.Api.Extractions.Schedules.ImmediateTrigger",

"LimitReportToTodaysData": "FALSE"

},

"InstrumentIdentifiers": [

{ "Identifier":"CNH=", "IdentifierType":"Ric" },

{ "Identifier":"CNY=", "IdentifierType":"Ric" },

],

"ValidationOptions": None,

"UseUserPreferencesForValidationOptions": "FALSE",

"Condition": None

}

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Narasimha_Prasad

    Thank you for reaching out to us.

    Please check the REST API Tutorial 10: GUI control calls: immediate extract tutorial in the Schedule an immediate extraction section.

    The request message looks like this:

    {

    "Name": "myImmediateSchedule",

    "Recurrence": {

    "@odata.type": "#DataScope.Select.Api.Extractions.Schedules.SingleRecurrence",

    "IsImmediate": true

    },

    "Trigger": {

    "@odata.type": "#DataScope.Select.Api.Extractions.Schedules.ImmediateTrigger",

    "LimitReportToTodaysData": true

    },

    "ListId": "0x080833021dedf0a1",

    "ReportTemplateId": "0x0808321dd61df091"

    }

    It requires ListId and ReportTemplateId.

    You can also download the DSS REST Tutorials Postman collection sample.