question

Upvotes
Accepted
5 2 9 12

Error in curl::curl_fetch_memory(url, handle = handle) :

While extracting TRTH data with REST API in R but got stuck in the last step to download completed extraction. I have followed the API reference tree to Extraction - ExtractedFile - GetDefaultStream. However, R gives me error message that:

Error in curl::curl_fetch_memory(url, handle = handle) :
Failed writing received data to disk/application.

I can't find anything helpful online about this issue with R. I remember that Refintiv has a tutorial on using REST API with R, so I am wondering if you have any suggestion on how to extract data with R.



I saw

tick-history-rest-apir-studio
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 @Prathibha.Mariyappa,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

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

Thanks

-AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such. Thanks, AHS


Upvotes
Accepted
11.3k 25 9 14

Hi @Prathibha.Mariyappa,

The following articles provides example scripts in R.

An example is available in Github.

The error seems like in the R library or script. You may try the examples to see if it works in your environment or not.

Also, I have tried the GetDefaultStream endpoint and can get result. Below is some sample.

> library(httr)
> library(jsonlite)
> token <- paste0("Token_h5bhL...")
> url <- paste0("https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractedFiles('VjF8fDU5NzQ5ODk2MA')/$value")
> r <- GET(url,add_headers(prefer = "respond-async",Authorization = token))
> r
Response [https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractedFiles('VjF8fDU5NzQ5ODk2MA')/$value]
  Date: 2020-03-11 08:55
  Status: 200
  Content-Type: text/plain
  Size: 122 B
RIC,Bid Price,Ask Price,Trade Date,Asset Type
AAPL.O,289.25,289.32,03/03/2020,EQTY
IBM.N,128.85,128.86,03/03/2020,EQTY
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
32.2k 40 11 20

Hello @Prathibha.Mariyappa,

You are not mentioning if you are able to extract other TRTH content successfully, and only have difficulty with this specific request, or you have not been able to retrieve any results.

I am not familiar with R tutorial.

To make sure that you are able to go through the steps that are required to retrieve from TRTH successfully:

1. Submit the request

2. Check the status of the job until the job is completed

3. Get the result

I would run one of the TRTH Postman tutorials, and once that is successfull, next , would replace the request in the tutorial with the one you are requiring. Once the request is successful in Postman, then one can move it into any code, including R.

Hope this helps

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.

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.