AdobeDocs/analytics-2.0-apis

/reports endpoint does not return a result when querying itemValue = "None"

Closed this issue · 1 comments

Expected Behaviour

For the dimension "variables/marketingchannels" the endpoint /reports returns, among others of course, the value "None":

Extract:

{
    'totalPages': 2,
    'firstPage': True,
    'lastPage': False,
    'numberOfElements': 10,
    'number': 0,
    'totalElements': 19,
    'columns': {
        'dimension': {
            'id': 'variables/marketingchannel',
            'type': 'string'
        },
        'columnIds': ['123']
    },
    'rows': [{
        'itemId': '0',
        'value': 'None',
        'data': [...]
    }, {
        'itemId': '1',
        'value': 'Search (Paid)',
        'data': [...]
    }
}

When using this value within a metric filter to create a breakdown

'metricFilters': [{
            'id': 0,
            'type': 'breakdown',
            'dimension': 'variables/marketingchannel',
            'itemValue': 'None'
        }]

the endpoint should return a result for breakdown based on this specific value.

Actual Behaviour

The actual response from the endpoint is:

'Filter with dimension [variables/marketingchannel] has invalid itemValues [[None]]',

It works if you provide an itemId:

'metricFilters': [{
            'id': 0,
            'type': 'breakdown',
            'dimension': 'variables/marketingchannel',
            'itemId': '0'
        }]

It also works with not None-values:

'metricFilters': [{
            'id': 0,
            'type': 'breakdown',
            'dimension': 'variables/marketingchannel',
            'itemValue': 'Search (Paid)'
        }]

It's also not working when you use "none", "Unspecified", None (Python-like null) or an empty string.

Platform and Version

Python 3.9.10 on MacOS 12.3.1

Sample Code that illustrates the problem

Using the SwaggerUI https://adobedocs.github.io/analytics-2.0-apis/

Working example

{
    "rsid": "reportsuite",
    "globalFilters": [{
        "type": "dateRange",
        "dateRange": "2022-04-01T00:00:00.000/2022-05-01T00:00:00.000"
    }],
    "dimension": "variables/prop1",
    "metricContainer": {
        "metrics": [{
            "id": "metrics/visits",
            "filters": [0]
        }],
        "metricFilters": [{
            "id": 0,
            "type": "breakdown",
            "dimension": "variables/marketingchannel",
            "itemValue": "None"
        }]
    }
}

Not working example:


{
    "rsid": "reportsuite",
    "globalFilters": [{
        "type": "dateRange",
        "dateRange": "2022-04-01T00:00:00.000/2022-05-01T00:00:00.000"
    }],
    "dimension": "variables/prop1",
    "metricContainer": {
        "metrics": [{
            "id": "metrics/visits",
            "filters": [0]
        }],
        "metricFilters": [{
            "id": 0,
            "type": "breakdown",
            "dimension": "variables/marketingchannel",
            "itemId": 0
        }]
    }
}

Get all values for "marketingchannel" to make sure that "None" exists as a value:

{
    "rsid": "reportsuite",
    "globalFilters": [{
        "type": "dateRange",
        "dateRange": "2022-04-01T00:00:00.000/2022-05-01T00:00:00.000"
    }],
    "dimension": "variables/marketingchannel",
    "metricContainer": {
        "metrics": [{
            "id": "metrics/visits"
        }]
    }
}

Logs taken while reproducing problem

@nickyreinert have you tried using nonesBehavior as part of the report settings? It would look something like this:

{
	"rsid": "reportsuite",
	"globalFilters": [{
		"type": "dateRange",
		"dateRange": "2022-04-01T00:00:00.000/2022-05-01T00:00:00.000"
	}],
	"dimension": "variables/prop1",
	"metricContainer": {
		"metrics": [{
			"id": "metrics/visits",
			"filters": [0]
		}],
		"metricFilters": [{
			"id": 0,
			"type": "breakdown",
			"dimension": "variables/marketingchannel",
			"itemValue": "None"
		}]
	},
	"settings": {
		"nonesBehavior": "return-nones"
	}
}

Possible values are return-nones, exclude-nones, default. I don't think those are really documented in the public API docs, so if those work I'll get a task made to update the public docs.