Pagination on the logs via Management API v2

I read the documentation to pull the logs from Auth0 using management API v2 as per the below screenshot. However, I could not understand how to pull the next 100 logs using pagination. In the documentation, it stated that we need to use the link in the headers for the next 100 logs but what I get in the link looks like not the correct URL. Could anyone please help to make me understand which link I should use to get the following 100 logs?

1 Like

Hi @impurush ,

Welcome to the Auth0 Community!

I tested the endpoint

https://{{my_tenant_domain}}/api/v2/logs?from=LOG_ID_1&take=100

In the response, it displays 100 logs in chronicle order, and the id of the last log is LOG_ID_100, and the HTTP Link header looks like

<https://{{my_tenant_domain}}/api/v2/logs?from=LOG_ID_100&take=100>; rel="next"

https://{{my_tenant_domain}}/api/v2/logs?from=LOG_ID_100&take=100 is the endpoint to retrieve the next batch with 100 logs.

Could you please provide additional details about what is in your Link header and what you expect in the Link Header field? Thanks!

2 Likes

Thanks for the reply
As you mentioned in your response, I tried that way but did not work, and got the 404, which says URL is not correct.

I tried the below endpoint
https://{{tenant_domain}}/api/v2/logs?from=LOG_ID&take=100

and the HTTP header link contains the below endpoint

https://{{tenant_domain}}/api/v2/logs?from=LOD_ID&take=100; rel=“next”

I tested this in Postman and it worked fine for me.

Could you please DM me the following details for further investigation?

  1. the screenshot of the initial GET request which is successful and returns the Link header.
  2. the value in the Link header. And is the log id available in the response body of the initial request?
  3. the screenshot of the error when sending the GET request with the URL in the Link header.

Thanks!

2 Likes

Finally it worked in the following way.

First 0-100 logs
https://{{tenant_domain}/api/v2/logs?from=LOG_ID&take=100

Next 100-200 logs
https://{{tenant_domain}/api/v2/logs?from=LOG_ID_FROM_HEADER_LINK&take=100&rel=next

Next 200-300 logs
https://{{tenant_domain}/api/v2/logs?from=LOG_ID_FROM_HEADER_LINK&take=100&rel=next

Thanks @lihua.zhang for your support.

:clap: Thanks for the updates @impurush!

1 Like

How can I pull the logs from Auth0 using management API v2…with the 0-100 logs with all this url …https://{{tenant_domain}/api/v2/logs?from=LOG_ID&take=100 Next 100-200 logs https://{{tenant_domain}/api/v2/logs?from=LOG_ID_FROM_HEADER_LINK&take=100&rel=next Next 200-300 logs https://{{tenant_domain}/api/v2/logs?from=LOG_ID_FROM_HEADE…I want to know how it operate…thank u

Hi @Shashamura ,

You can use Postman and make a GET request to those URLs as endpoint to pull the logs. Here is a screenshot.

Hope this helps!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.