geral2 / SQL-APIConsumer

Database Project with generic procedures to consume API through GET/POST methods.
MIT License
140 stars 47 forks source link

APICaller_GET Truncating Data #23

Closed tamhaneaniket closed 4 years ago

tamhaneaniket commented 4 years ago

Hi Geraldo,

I am noticing that the API call APICaller_GET is truncating the data and not returning the full object. Is there a limit to the data which is being returned?

Thanks

geral2 commented 4 years ago

Hi!,

Depending on the version you have, the first version returned 4000 characters. But it was fixed in #8 to return 2GB. What's the length of data you are getting?

tamhaneaniket commented 4 years ago

I am getting about 44,000 characters...I am using SQL Server 2012 and version 2.0.0.4 for API_Consumer dll...

geral2 commented 4 years ago

I just tested in my SQL Server 2012 instance; The sample below returned 149,716 chars.

--Set Header
Declare @header nvarchar(max) = '[{
                                  "Name": "X-RapidAPI-Host",
                                  "Value" :"restcountries-v1.p.rapidapi.com"
                                },{
                                  "Name": "X-RapidAPI-Key",
                                  "Value" :"c56b333d25mshdbfec15f02f096ep19fa94jsne5189032cf7d"
                                }]';
--Set URL
Declare @wurl varchar(max) = 'https://restcountries-v1.p.rapidapi.com/all' 

Declare @ts as table(Json_Table nvarchar(max))

 insert into @ts
 --Get Account Data
 exec [dbo].APICaller_GET_headers
                            @wurl
                            ,@header

SELECT LEN(Json_Table) FROM  @ts

image

tamhaneaniket commented 4 years ago

Thanks a lot...it worked. I was getting confused because i was copying the output from the SQL Server Results window and that seems to have a limitation on the characters. The actual result contains the full output.....

Thanks for your super quick help again....

geral2 commented 4 years ago

You're welcome!