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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
23 9 14 23

full holdings for a fund and ETF DSS Rest API request generates Http error code : 202

Hi All,

I have urgent query.

I am using below DSS Rest API refinitiv request for full holdings for a fund and sending 50 Identifier requests at a time. But since Monday this week we are getting error : Got http error code: 202: And at the end we are able to process and fetch response for only few Identifiers.

We are using daily job at 6am to provide the DSS Rest API request to refinitiv and fetch response.

When i tried to run the same java code and provide DSS Rest API request to refinitiv in the afternoon at 3pm then i am not facing any issue and we are able to fetch the response for most of the Identifiers.


This is critical issue for us. Can you please provide an information if the refinitiv DSS Rest API request has issues in the morning time for full holdings for a fund and ETFs? We did not face this issue before.


Below is the DSS Rest API request for full holdings for a fund. And i am facing the same issue for ETF also:

"ExtractionRequest": {
            "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.FundAllocationExtractionRequest",
            "ContentFieldNames": [
              "Security Description",
              "Allocation Asset Type",
              "Allocation Date",
              "Allocation Item",     
              "Allocation Percentage",      
              "Allocation ISIN",      
              "Market Value Currency",
              "Market Value Held"     
            ],
            "IdentifierList": {
              "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
              "InstrumentIdentifiers": [%s],
              "ValidationOptions": null,
              "UseUserPreferencesForValidationOptions": false
            },
            "Condition": {
              "FundAllocationTypes": [
                "Asset",
                "Currency",
                "FullHoldings",
                "IndustrySector",
                "InvestmentCountry",
                "TopTenHoldings"
              ]
            }
          }
        }
        """



dss-rest-apidatascope-selectdssdatafunds
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.

Hello @rahul.deshmukh

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,


AHS


Upvotes
Accepted
22k 58 14 21
I am already using below method as asynchronous request in my code. connection.setRequestProperty('Prefer', 'respond-async')

Get rid of this line to get a synchronous response (HTTP 200). Your application might have to wait a very long time for data, and intermediate network components like routers/proxies might drop your connection.

If you need to speak with DSS technical support team, please raise a ticket at MyRefinitiv and select appropriate product.

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.

@Gurpreet thanks i will try to remove the below line connection.setRequestProperty('Prefer', 'respond-async')

and check again if i get the same issue with (HTTP 202) and also communicate with technical support team in case any further issue.

@Gurpreet i tried to remove connection.setRequestProperty('Prefer', 'respond-async') part from my code and now i dont see any issue with http error 202 thanks

Upvotes
22k 58 14 21

Hi @rahul.deshmukh,

HTTP 202 is not an error but a status message. It means that server is processing your request.

You can use this Python code snippet as a starting point for your application (keep checking the response message until error or 200)

def checkStatus(url):
    hdrs = {
        "Authorization": "Token " + myToken,
        "Prefer": "respond-async, wait=60"
    };
    return sess.get(url, headers = hdrs);

# is it a 202 (in progress)
while (resp.status_code == 202):
    print("waiting...");
    # check if the response completed yet
    URL = resp.headers['Location'];
    resp = checkStatus(URL);

You can see that, this async behavior occurs because we specify respond-async in the request header. If this parameter was omitted, it will become a synchronous call, and your request will block until the data is fulfilled.

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.

Hi Gurpreet,

As i mentioned in question, we didn't faced this issue till last week while using the rest api which i have mentioned and since Monday morning this week where our job is scheduled at 6am daily, we are getting lot of http error :202. and we are missing lot of FUND_ISIN(Identifier) which has not been processed.


The strange part is i tried to run the java code in the afternoon using the same rest api and i didnt got this http error:202 and we are able to process most of the fund_isin(identifiers). But this seems to be not solution as we need this data in the morning.


We are using Java using rest api and not python. If you can please provide me change which i need to do in this rest api will be helpful. This is critical issue for us.

Thanks.

Currently we have 3700 Identifiers and i am sending 50 Identifiers at once to resp api request...And to process all the 3700 Identifiers takes 1.5 hours.....If i reduce sending 20 Identifier at once to rest api request then it takes more thans 3 hours which is too much..

Upvotes
22k 58 14 21

@rahul.deshmukh, Please read about asynchronous mechanism in the DSS documentation. What you are describing as an error, is a feature which web technologies use when long wait times are expected. Why your application has to wait at certain times, might be due to the load on the server, time of the day or other embargo conditions etc. Either way, if you are requesting async mechanism, then your application should be ready to handle async response.

See the DSS2OnDemandIntradayBarsTRTH.java example in the downloads section, on how to handle async communication.

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.

@Gurpreet I am already using below method as asynchronous request in my code.

As you said why we have to wait certain times because of load on server or may be due to other embargo conditions etc and i believe this is happening here and we would like to know the exact reason of this issue because we are not able to process all the Identifiers which is critical issue for us.

//Connection to the URL string https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes
    private static HttpURLConnection connection(String urlSpec) {
        HttpURLConnection connection = new URL(urlSpec).openConnection() as HttpURLConnection

        connection.setRequestProperty('Prefer', 'respond-async')
        connection.setRequestProperty('Accept', 'application/json')

        connection.setRequestMethod("POST")
        connection.setRequestProperty("Content-Type", "application/json; utf-8")
        connection.setDoOutput(true)
        connection
    }

And then for generating authentication token:

HttpURLConnection connection = connection("https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes")

connection.setRequestProperty('Authorization', "Token $authToken")




I already mentioned the time(daily at 6am) on which we are trying to send request to dss rest api to refinitiv. Is it possible for you to find during this time if we have too much load on server or are there any other embargo conditions ? Or do you know any other further contacts with whom we can reach ?

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.