Get Users / Get User Logs - Response type + Swagger issue

I’ve found a couple of issues regarding these two endpoints regarding the include_totals parameter.

The current behaviour is as follows:

  • /api/v2/users?include_totals=false returns an array of users, E.g:
    [
    	{
    		"user_id": "auth0|0123456789",
    		"email": "email@domain.com",
    		...
    	},
    	...
    ]
    
  • /api/v2/users?include_totals=true returns an object representing a page of users, E.g:
    {
    	"start": 0,
    	"limit": 2,
    	"length": 2,
    	"users": [
    		{
    			"user_id": "auth0|0123456789",
    			"email": "email@domain.com",
    			...
    		},
    		...
    	],
    	"total": 17
    }
    
  • /api/v2/users/{user_id}/logs?include_totals=false returns an object with user logs and a length, E.g:
    {
    	"0": {
    		"date": "1970-01-01T01:02:03.123Z",
    		"type": "s",
    		"connection": "google-oauth2",
    		...
    	},
    	"1": {
    		"date": "1970-01-02T01:02:03.123Z",
    		"type": "s",
    		"connection": "google-oauth2",
    		...
    	},
    	...,
    	"length": 2
    }
    
  • /api/v2/users/{user_id}/logs?include_totals=true returns an object representing a page of user logs, E.g:
    {
    	"length": 2,
    	"total": 6,
    	"start": 0,
    	"limit": 2,
    	"logs": [
    		{
    			"date": "1970-01-01T01:02:03.123Z",
    			"type": "s",
    			"connection": "google-oauth2",
    			...
    		},
    		{
    			"date": "1970-01-02T01:02:03.123Z",
    			"type": "s",
    			"connection": "google-oauth2",
    			...
    		},
    		...
    	]
    }
    

The first issue is that in the Users Swagger file, the responses to both of these endpoints are defined as an array of records which is only correct for /api/v2/users?include_totals=false. To properly represent this behavour, Swagger / OpenAPI v3’s oneOf keyword is required to correctly document the difference between paged and non-paged results, but the current documentation for /api/v2/users/{user_id}/logs does not match either mode.

The second issue is that the format of the result from /api/v2/users/{user_id}/logs?include_totals=false doesn’t seem to make sense. In my opinion it should be a plain array to match /api/v2/users?include_totals=false.

Hey @yngndrw-sage

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!

Hi @James.Morrison,

The inconsistency with /api/v2/users/{user_id}/logs?include_totals=false has since been resolved.

The Swagger issue is still outstanding as the return type doesn’t exactly match the output, especially with include_totals=true.

When you get a chance @yngndrw-sage can you share an example output related to the Swagger issue as well as any additional details you may be able give on subject? Thanks in advance.

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