Recent

Author Topic: [Solved] TFPHTTPClient read headers of response?  (Read 417 times)

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
[Solved] TFPHTTPClient read headers of response?
« on: February 23, 2024, 10:32:13 pm »
Hi, according to this API I'm using, I need to do pagination to retrieve more than 30 items:
https://github.com/TiendaNube/api-docs?tab=readme-ov-file#pagination

Quote
To check the next and previous links for pagination you can use the Link header:

Quote
Link: <https://api.tiendanube.com/v1/123456/products?page=3&per_page=100>; rel="next",
  <https://api.tiendanube.com/v1/123456/products?page=50&per_page=100>; rel="last"

How I can read the headers of the response (if possible) with TFPHTTPClient?

Also how I can grab the url from that text, giving this example:

Quote
Link: <https://api.tiendanube.com/v1/123456/products?page=3&per_page=100>; rel="next",
  <https://api.tiendanube.com/v1/123456/products?page=50&per_page=100>; rel="last"

I need to read 'next' url to pass it to the next batch of GET...

Edit: maybe with pos(<) then pos(>) of the first line and copy(...)

Thanks in advance
« Last Edit: February 23, 2024, 11:22:58 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: TFPHTTPClient read headers of response?
« Reply #1 on: February 23, 2024, 11:22:30 pm »
Solved, there's a ResponseHeaders property..

 

TinyPortal © 2005-2018