Jump to content
jjw

tsslhttprest response header

Recommended Posts

Hey

 

Can someone help me please or point me in the right direction.

im trying to figure out how i can get the response headers from the TSslHttpRest

 

here is my scenario:

I need to get multiple JSON files from a web API

(Containing 2 parameters and 1 authentication header)

*sslhttprest.RestParams.AddItem('page_number', inttostr(x));

*sslhttprest.RestParams.AddItem('page_size', inttostr(y));

& * sslhttprest.ExtraHeaders.Add('Authorization: xxxx');

 

Downloading the JSON file to Stream / File works fine.

but i need the additional response header info, supplied by the 3rd party, as it contains additional basic info that i need to abide by (how many calls per minute i can make vs how many i already did)

 

is this possible?

 

Screenshot from Postman' Response below

image.thumb.png.ae63ad688a0e84e7d24fcddfe501bbc0.png

 

Thanks in advance

JJ

Edited by jjw

Share this post


Link to post

OnHeaderData should probably work for you. From the handler, access the LastResponse property to get the line.

Share this post


Link to post

THttpCli and TSslHttpRest have a property RcvdHeader: TStrings which after a request completes has all the received headers, so just search it for your X headers.

 

Angus

 

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×