Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.
SOLVED

Using search clause in reporting API and sorting data by metric

Avatar

Level 2

Hi,

I am trying to retrieve data provided in a report using the Adobe Reporting API.

I have a pages report and would like to get top 20 pages containing a specific keyword and sorted by pageviews on a specific date. I see that search clause helps you search by dimension but not sure how to use it in the json response code. Also, is there a way to sort by metric. My dimension is Page and Metric is Pageviews.

Thank you!

1 Accepted Solution

Avatar

Correct answer by
Level 2

Yes, I was able to get the exact json request required using the below steps:

Using Adobe Analytics interface

Using the debugger to get request and access_token

  1. Go to Analysis Workspace and open the report that you want to reproduce via API.
  2. Open a the developer console in your browser and input

    1. adobe.tools.debug.includeOberonXml = true 
  3. Reload the page and you should see an orange bug next to each table and visualisations
  4. Click on the orange bug
  5. Click on Freeform tables
  6. Select entry with the most up to date date
  7. A screen should be displayed with title Oberon request

Analytics API thanks to

Alexis Cazes Adobe

View solution in original post

7 Replies

Avatar

Employee Advisor

You would want to use a segment instead of search. If you only pull in a single dimension, it will automatically sort by that.

Are you using the v1.4 or v2.0 API?

Avatar

Community Advisor

In API 1.4 you can't filter on a dimension directly, a call like "where page contains 'help' or 'contact'" does not work. the "contains" is only supported for classifications. what you need here are inline segments: https://github.com/AdobeDocs/analytics-1.4-apis/blob/master/docs/reporting-api/inline_segments.md

as a workaround you could add a classification to the desired dimension (eg. "page copy") and just copy the original value to the classified one by simply use a regex rule ".*"

havin g the classified value (which is basically the original one) allows to filter by a "contains"

and as Gigazelle​ said, it's always ordered by the metric by default or what you indicate in the API call. see "sortby" here: https://github.com/AdobeDocs/analytics-1.4-apis/blob/master/docs/reporting-api/data_types/r_reportDe...

Avatar

Level 2

We are using API 2.0. I was able to search pages by adding search clause:

"dimension": "variables/page",

    "search": {

        "clause": "( CONTAINS 'contact' )"

    },

Avatar

Community Advisor

if you are using API 2.0 and open console to inspect the API calls. that means you can build the desired table in workspace and have your API call in the network traffic.

There is even a hidden feature which allows you to show a debug mode and directly inspect the API for each table. can't find the link anymore, maybe ericmatisoff​ or Gigazelle​ have the link?

Avatar

Correct answer by
Level 2

Yes, I was able to get the exact json request required using the below steps:

Using Adobe Analytics interface

Using the debugger to get request and access_token

  1. Go to Analysis Workspace and open the report that you want to reproduce via API.
  2. Open a the developer console in your browser and input

    1. adobe.tools.debug.includeOberonXml = true 
  3. Reload the page and you should see an orange bug next to each table and visualisations
  4. Click on the orange bug
  5. Click on Freeform tables
  6. Select entry with the most up to date date
  7. A screen should be displayed with title Oberon request

Analytics API thanks to

Alexis Cazes Adobe

Avatar

Community Advisor

exactly what I was looking for. thanks for posting it!

Avatar

Level 2

"dimension": "variables/page" this statement saved my whole week.Thank you