Expand my Community achievements bar.

Announcement: Calling all learners and mentors! Applications are now open for the Adobe Analytics 2024 Mentorship Program! Come learn from the best to prepare for an official certification in Adobe Analytics.
SOLVED

Report API 2.0

Avatar

Level 2

Hi I tried JSON which given by debugger. In output response I am getting only visits data but not getting segments name level.I want to see segments name and visit data in output response.For your information Dimension parameter is missing in JSON which is given by debugger

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Thanks, but this doesn't really show me the structure of your table.. I can see that you have segments as your breakdown.. I'm not sure if there are multiple.. do those segments have additional breakdowns, or just the segments... I am also going to assume you have some additional columns of metrics (which are also cut out of this screenshot).

 

I am going to assume, something like this (multiple segments and multiple metrics):

Jennifer_Dungan_0-1707634609506.png

 

 

My JSON (the last one that was run), looks like:

{
    "rsid": "xxxxxx",
    "globalFilters": [
        {
            "type": "dateRange",
            "dateRange": "2024-02-01T00:00:00.000/2024-03-01T00:00:00.000",
            "dateRangeId": "thisMonth"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "metrics/visits:::0",
                "id": "metrics/visits",
                "filters": [
                    "STATIC_ROW_COMPONENT_1"
                ]
            },
            {
                "columnId": "metrics/pageviews:::2",
                "id": "metrics/pageviews",
                "filters": [
                    "STATIC_ROW_COMPONENT_3"
                ]
            },
            {
                "columnId": "metrics/visits:::4",
                "id": "metrics/visits",
                "filters": [
                    "STATIC_ROW_COMPONENT_5"
                ]
            },
            {
                "columnId": "metrics/pageviews:::6",
                "id": "metrics/pageviews",
                "filters": [
                    "STATIC_ROW_COMPONENT_7"
                ]
            }
        ],
        "metricFilters": [
            {
                "id": "STATIC_ROW_COMPONENT_1",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000001"
            },
            {
                "id": "STATIC_ROW_COMPONENT_3",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000001"
            },
            {
                "id": "STATIC_ROW_COMPONENT_5",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000002"
            },
            {
                "id": "STATIC_ROW_COMPONENT_7",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000002"
            }
        ]
    },
    "settings": {
        "countRepeatInstances": true,
        "includeAnnotations": true
    },
    "statistics": {
        "functions": [
            "col-max",
            "col-min"
        ]
    },
    "capacityMetadata": {
        "associations": [
            {
                "name": "applicationName",
                "value": "Analysis Workspace UI"
            }
        ]
    }
}

 

 

I've obscured my segment ids, but you can that I have 2 segments (s000000000_000000000000000000000001 and s000000000_000000000000000000000002)

 

The JSON is mapping my 2 metrics against the "static rows" which are segments.

 

So I have 4 column ids, 2 for Visits (that map to the 2 segments) and 2 for Page Views (which also map to the 2 segments)

 

"columnId": "metrics/visits:::0",
"id": "metrics/visits",
"filters": [
    "STATIC_ROW_COMPONENT_1"
]

 

Maps my Visit Metric to "STATIC_ROW_COMPONENT_1", and "STATIC_ROW_COMPONENT_1" is defined below with the segment id:

 

"id": "STATIC_ROW_COMPONENT_1",
"type": "segment",
"segmentId": "s300007135_65c86f2e0e503637bad71f6b"

 

 

Each of the 4 cells of data is defined this way.

 

 

This is the data as returned by the debugger.

View solution in original post

7 Replies

Avatar

Community Advisor

I don't believe you will see the Segment "name"... as far as I am aware, the API only uses the segment "ID".

 

Maybe if you show us the basic structure of your table (you can hide values and specific naming conventions if you like), but knowing what you are trying to pull would allow us to replicate what you are trying to do and see if we can offer more detailed support.

Avatar

Correct answer by
Community Advisor

Thanks, but this doesn't really show me the structure of your table.. I can see that you have segments as your breakdown.. I'm not sure if there are multiple.. do those segments have additional breakdowns, or just the segments... I am also going to assume you have some additional columns of metrics (which are also cut out of this screenshot).

 

I am going to assume, something like this (multiple segments and multiple metrics):

Jennifer_Dungan_0-1707634609506.png

 

 

My JSON (the last one that was run), looks like:

{
    "rsid": "xxxxxx",
    "globalFilters": [
        {
            "type": "dateRange",
            "dateRange": "2024-02-01T00:00:00.000/2024-03-01T00:00:00.000",
            "dateRangeId": "thisMonth"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "metrics/visits:::0",
                "id": "metrics/visits",
                "filters": [
                    "STATIC_ROW_COMPONENT_1"
                ]
            },
            {
                "columnId": "metrics/pageviews:::2",
                "id": "metrics/pageviews",
                "filters": [
                    "STATIC_ROW_COMPONENT_3"
                ]
            },
            {
                "columnId": "metrics/visits:::4",
                "id": "metrics/visits",
                "filters": [
                    "STATIC_ROW_COMPONENT_5"
                ]
            },
            {
                "columnId": "metrics/pageviews:::6",
                "id": "metrics/pageviews",
                "filters": [
                    "STATIC_ROW_COMPONENT_7"
                ]
            }
        ],
        "metricFilters": [
            {
                "id": "STATIC_ROW_COMPONENT_1",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000001"
            },
            {
                "id": "STATIC_ROW_COMPONENT_3",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000001"
            },
            {
                "id": "STATIC_ROW_COMPONENT_5",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000002"
            },
            {
                "id": "STATIC_ROW_COMPONENT_7",
                "type": "segment",
                "segmentId": "s000000000_000000000000000000000002"
            }
        ]
    },
    "settings": {
        "countRepeatInstances": true,
        "includeAnnotations": true
    },
    "statistics": {
        "functions": [
            "col-max",
            "col-min"
        ]
    },
    "capacityMetadata": {
        "associations": [
            {
                "name": "applicationName",
                "value": "Analysis Workspace UI"
            }
        ]
    }
}

 

 

I've obscured my segment ids, but you can that I have 2 segments (s000000000_000000000000000000000001 and s000000000_000000000000000000000002)

 

The JSON is mapping my 2 metrics against the "static rows" which are segments.

 

So I have 4 column ids, 2 for Visits (that map to the 2 segments) and 2 for Page Views (which also map to the 2 segments)

 

"columnId": "metrics/visits:::0",
"id": "metrics/visits",
"filters": [
    "STATIC_ROW_COMPONENT_1"
]

 

Maps my Visit Metric to "STATIC_ROW_COMPONENT_1", and "STATIC_ROW_COMPONENT_1" is defined below with the segment id:

 

"id": "STATIC_ROW_COMPONENT_1",
"type": "segment",
"segmentId": "s300007135_65c86f2e0e503637bad71f6b"

 

 

Each of the 4 cells of data is defined this way.

 

 

This is the data as returned by the debugger.

Avatar

Level 2

Thank you for deep explanation.I have only visit column there and we don’t have any additional breakdown.We have 30 segments name there so in metric filter we have 30 segments I’d is there.Are you getting segments name in output?.My JSON almost similar to yours.

Avatar

Community Advisor

Hi, sorry for the late reply.

 

The Response for me (in the debugger) is:

 

{
    "totalPages": 0,
    "firstPage": true,
    "lastPage": true,
    "numberOfElements": 0,
    "number": 0,
    "totalElements": 0,
    "columns": {
        "columnIds": [
            "metrics/visits:::0",
            "metrics/pageviews:::2",
            "metrics/visits:::4",
            "metrics/pageviews:::6"
        ]
    },
    "summaryData": {
        "filteredTotals": [
            12345,
            1234,
            67890,
            6789
        ],
        "annotations": [],
        "totals": [
            12345,
            1234,
            67890,
            6789
        ],
        "annotationExceptions": []
    }
}

 

 

My values are obscured with some random numbers.

 

Because everything is a "static" return based on segments, all 4 pieces of info are returned in one section, and then the totals are returned... I am not sure why both sets of values are identical... 

 

However, I can see that the response calls the data in a similar fashion:

 

"metrics/visits:::0",
"metrics/pageviews:::2",
"metrics/visits:::4",
"metrics/pageviews:::6"

 

the first value is Visits, and corresponds to the request column for "STATIC_ROW_COMPONENT_1", the second is Page Views and corresponds to "STATIC_ROW_COMPONENT_3"

 

 

All the metrics are returned for me (they are included in both the request and the response).

 

 

Silly question, but there may be multiple API calls shown by your debugger, are you sure you grabbed the last one by timestamp?

 

Jennifer_Dungan_0-1707673469289.png

 

 

Since I was building this table to help you, each time I added a metric or segment, the data was refreshed... therefore it had a new timestamp added to this list... I had to make sure I grabbed the last timestamp that had everything included.

 

If there is doubt. Save your Workspace, close it, open it fresh... this should now show you only the new timestamp(s) relative to the current state of your data.

Avatar

Level 2

Thank you.output response of mine is almost similar to yours.I am also not getting segment names in output.How to get segment names, Do you have any solutions ?

Avatar

Community Advisor

I don't think it's possible.. I think you just have to know what segments you are using in your request and what static value each is tied to, then map the names back in post-processing of the response....

 

I think you can also get details about the segments by running the segment Retrieval API (/segments/{id}).. but you would need to run this for all segments, and you would need to know the exact segments from original request... Since segments all have to be curated into your request, it's probably just a lot easier to use a mapping table:

 

s000000000_000000000000000000000001 = "segment x"

s000000000_000000000000000000000002 = "segment y"

 

 

If you are unsure about which is which in the request (since Adobe is building the request for you), if you open your segments in edit mode, you can see the segment ID in the url.

 

https://experience.adobe.com/#/....... /#/components/segments/edit/s000000000_000000000000000000000001