Abdullah Faruk
Abdullah Faruk

Reputation: 1011

Omniture Report REST API call

Can anyone suggest me regarding Omniture REST API call in order to generate report (for example; I need to generate monthly report for top ten browsers by revenue and top ten browsers by operating system etc?

Upvotes: 2

Views: 5815

Answers (2)

Pitchkrak
Pitchkrak

Reputation: 370

I created a python module that works as an high level API for Adobe Analytics. You can check it out here : http://www.datanalyst.info/python/adobe-api/adobe-analytics-api-introduction/

It will retrieved you the report you want and save it as csv file.

Upvotes: -1

CrayonViolent
CrayonViolent

Reputation: 32532

First, use the Report.Queue method to create the report request.

Here is an example for last month:

{
    "reportDescription":{
        "reportSuiteID":"rsidhere",
        "date":"2015-10",
        "metrics":[
            {
                "id":"revenue"
            }
        ],
        "sortBy":"revenue",
        "elements":[
            {
                "id":"browser",
                "top":"10",
                "startingWith":"1"
            }
        ]
    }
}

This should give you a response with the report request id, example:

{
    "reportID":123456789
}

Then, use Report.GetQueue to check the status of the report.

The only thing to send to this method is an empty [] array. The report queue is global to the whole company. It will return an array of objects that look something like this (example):

[
    {
        "reportID":"123456789",
        "type":"ranked",
        "queueTime":"2015-11-14 03:24:23",
        "status":"waiting",
        "priority":"0",
        "estimate":"0",
        "user":"user"
    }
    // , {..}
]

Since more than 1 object can be in the array (depends on if you have any other reports in the queue), you will have to loop through it and look for the reportID that matches.

The status property will show "waiting" or "running". It will never show "complete" or anything. If you do NOT find your reportID in the array, that means the report is complete and ready to retrieve.

When the report is ready, use the Report.Get method to retrieve the report.

You use the same returned value from the original Report.Queue to get the report:

{
    "reportID":123456789
}

Note: The documentation says if you attempt to use Report.Get when the report is not ready to be retrieved, you will get an error message saying the report is not ready. So at face value, this sounds like a reasonable way to skip checking Report.GetQueue. However, in practice, I have found that depending on what type of report I request, how much data will be returned, etc. (I don't know exact formula), this is not true. Sometimes it will instead return a partial report!

The returned report will look something like this (example):

  • data[n].name shows the browser
  • data[n].counts[0] shows the revenue

response

{
    "report":{
        "type":"ranked",
        "elements":[
            {
                "id":"browser",
                "name":"Browser"
            }
        ],
        "reportSuite":{
            "id":"rsidhere",
            "name":"some rsid"
        },
        "period":"October 2015",
        "metrics":[
            {
                "id":"revenue",
                "name":"Revenue",
                "type":"currency",
                "decimals":2,
                "latency":2696,
                "current":false
            }
        ],
        "data":[
            {
                "name":"Microsoft Internet Explorer 11",
                "url":"",
                "counts":[
                    "474127.13"
                ]
            },
            {
                "name":"Google Chrome 45.0",
                "url":"",
                "counts":[
                    "409498.61"
                ]
            },
            {
                "name":"Google Chrome 46.0",
                "url":"",
                "counts":[
                    "355380.86"
                ]
            },
            {
                "name":"Safari 9.0",
                "url":"",
                "counts":[
                    "275003.13"
                ]
            },
            {
                "name":"Mozilla Firefox 41.0",
                "url":"",
                "counts":[
                    "166427.91"
                ]
            },
            {
                "name":"Safari 8.0",
                "url":"",
                "counts":[
                    "125681.54"
                ]
            },
            {
                "name":"Safari 0.8.2",
                "url":"",
                "counts":[
                    "103866.64"
                ]
            },
            {
                "name":"::unspecified::",
                "url":"",
                "counts":[
                    "87761.87"
                ]
            },
            {
                "name":"Safari 8.0.8",
                "url":"",
                "counts":[
                    "79675.79"
                ]
            },
            {
                "name":"Safari 9.0.1",
                "url":"",
                "counts":[
                    "76977.82"
                ]
            }
        ],
        "totals":[
            "2823943.75"
        ],
        "version":"1.4.15.11"
    },
    "waitSeconds":"0.943",
    "runSeconds":"8.710"
}

Note: You can use Adobe API Explorer to try out the API methods and see responses and help build your scripts.

Upvotes: 6

Related Questions