For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 1

How to export challenges' data from Rest API using Python?

I'm trying to export some challenges' information with the following url:

https://selectapi.datascope.refinitiv.com/RestApi/v1/EvaluationConnect/ChallengeExport

I already have the challenges Ids, but I don't know how to make it work in Python. It would be useful if someone could provide an example.

dss-rest-api#technology#productpython api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
78.6k 248 52 74

@sebastian.cartin

Thank you for reaching out to us.

You can refer to the DSS REST API Reference Tree that demonstrates how to use the API.

In the Request / Response Examples section, you will see the sample request message.

1687834574351.png

Then, you can test the request in Postman and then use Postman to generate a Python snippet code.

For example:

import requests
import json
url = "https://selectapi.datascope.refinitiv.com/RestApi/v1/EvaluationConnect/ChallengeExport"
payload = json.dumps({
  "ChallengeIds": [
    "999AAA",
    "999AAB",
    "999AAC",
    "999AAD"
  ],
  "Fields": [
    "BatchReferenceNumber",
    "BondAssetId",
    "ChallengedValuationRun",
    "ChallengedValuationPriceAt",
    "ChallengedValuationPriceValue",
    "BondRic",
    "BondCusip",
    "BondIsin",
    "BondSedol",
    "BondDbType",
    "BondDbSubType",
    "BondDescription",
    "ChallengeType",
    "ClientName",
    "SubmitterName",
    "SubmissionTime",
    "ChallengeHistoryType",
    "EvaluatorComment",
    "BondUserProvidedIdentifier",
    "ClientPrice",
    "TrpsAdjustedPrice",
    "ExcludeFromStatisticReport",
    "Id"
  ]
})
headers = {
  'Authorization': 'Token <token>',
  'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)

Please refer to the Generate code for a REST API call using Postman in just a few clicks article which shows how to generate Python code from Postman.


1687834574351.png (36.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 1

@Jirapongse

Thank you so much for answering! I tried to replicate the code and use some IDs. I get a successful request but only the headers appear.

output.png

I printed the payload (which has the IDs and Fields that I used) and the response. As you see, in the "value" there is only the headers but not the information for those IDs. Could it be possible that these IDs are not available?


output.png (18.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@sebastian.cartin

You can use this endpoint (/EvaluationConnect/Challenges) to get all Challenges.

import requests

url = "https://selectapi.datascope.refinitiv.com/RestApi/v1//EvaluationConnect/Challenges"

payload = ""
headers = {
  'Authorization': 'Token <token>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.