question

Upvotes
Accepted
1 0 0 1

cURL - problems with data download TRTH V2 Rest API

I have problem with data download via cURL. However, when I post the link below to Chrome I get the results. Token is correct.

qas # curl -H "Content-Type: application/json" -H "Authorization:Token $token" -X GET "https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/RawExtractionResults('0x06xxxx2')/\$value" -x proxy.xx.xx.pl:80 -k

▒▒▒

▒@▒▒>▒B▒F▒Y▒Ƞ▒iD)▒.ݖ\c▒/ԋo_▒▒▒ea▒=|▒▒▒*9▒▒Fu▒Vg▒-S?▒▒1j*ej▒T▒▒▒TNq▒.y▒▒▒▒!,▒N▒▒ɦ,▒

▒xK▒▒j

▒f8▒▒▒▒"CBɂf▒▒▒<▒%c▒▒▒f▒uߪL

▒▒Лz▒"▒▒ޢ=$▒P▒{▒r▒n▒7▒s

tick-history-rest-apirest-api
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 @ksm1234

The result of ExtractRaw should be in gzip compression format and cannot display to console directly. You need to redirect output to a gzip file via the "-o <filename.gz>" option ,and then use other tools such as gunzip command to decompress the file.

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.

Yes, excellent point :-)

Upvotes
13.7k 26 8 12

@ksm1234,

The output in the query above is unreadable, but 3 things catch my eye in the query:

  • The content type, which for this request is usually "Accept-Encoding:gzip,deflate".
  • The "/\" in front of "$value". Can you try the same command but remove the "\", i.e. use "/$value" ?
  • The word "proxy", but maybe this is just obfuscation or a host name ? Just to be clear, in curl the proxy setting is "-x <IP>:<port>", for example "-x 192.168.0.1:8080"

So to summarize, I'd try this (after setting the appropriate JobId and proxy IP address):

curl -H "Content-Type:Accept-Encoding:gzip,deflate" -H "Authorization:Token $token" -X GET "https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/RawExtractionResults('0x06xxxx2')/$value" -x 192.168.0.1:80 -k

If my suggestions do not help, please re-post the output of the curl command.

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