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.

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @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.

Answers