question

Upvotes
Accepted
3 0 2 8

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 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
11.3k 25 8 13

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 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea