Calling API from T-SQL, getting 200 but blank request headers, blank response text

Hello,

I am attemping to extract companies from HubSpot by calling the API through a SQL Stored Procedure. I am connecting to HubSpot per the logs with HTTP status of 200, but the request headers and response are all blank. Here is my code:

Any ideas on what I’m doing incorrectly?

Hi @AVogg , on the surface, everything looks fine, but I have not used the same tools that you are.

Did you confirm it is working with something like postman?

@lynton , do you have any ideas?

Try adding the properties querystring parameter:

A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.

I’m not familiar with this T-SQL approach of calling the API. As a next step for troublehooting, I’d suggest installing Fiddler on the same machine as SQL Server. Then you can listen for the requests and see exactly what is being sent from your server to HubSpot.

Thanks for replies. I’ll try these suggestions today.

Well I got it to work, but I don’t really know why lol.

I changed my @responseText variable to be of type table:

DECLARE @responseText TABLE(responseJSON NVARCHAR(MAX));

and I inserted the responseText into that:

INSERT INTO @responseText exec sp_OAGetProperty @token, ‘responseText’

and it works. but this seems like the exact same thing i was doing before. Oddly, the HubSpot page showing the request/response headers and body are still completely blank for me.

/shrug, i can make this work. thanks for the help!