Using search clause in reporting API and sorting data by metric

Avatar

Avatar

truptig90

Avatar

truptig90

truptig90

07-11-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

truptig90

Avatar

truptig90

truptig90

16-11-2018

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

Answers (6)

Answers (6)

Avatar

Avatar

truptig90

Avatar

truptig90

truptig90

16-11-2018

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

"dimension": "variables/page",

    "search": {

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

    },

Avatar

Avatar

keremkulak

Avatar

keremkulak

keremkulak

03-05-2019

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

Avatar

Avatar

ursboller

MVP

Avatar

ursboller

MVP

ursboller
MVP

16-11-2018

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

Avatar

Avatar

ursboller

MVP

Avatar

ursboller

MVP

ursboller
MVP

16-11-2018

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

Avatar

ursboller

MVP

Avatar

ursboller

MVP

ursboller
MVP

14-11-2018

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

Avatar

Gigazelle

Employee

Avatar

Gigazelle

Employee

Gigazelle
Employee

14-11-2018

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?