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.

Retrieving details for a Calculated Metric using API

Avatar

Level 4

I am trying to get some information about calculated metrics using the Reports & Analytics API v1.4

The documentation at: analytics-1.4-apis/calculated_metrics.md at master · AdobeDocs/analytics-1.4-apis · GitHub includes the following example:

{

     "accessLevel": "(string)",

     "fields": ["(string)"],

     "filters": {

          "name": "(string)",

          "tags": "(string)",

          "owner": "(string)",

          "reportSuiteID": "(string)",

          "approved": "(boolean)",

          "favorite": "(boolean)"

     },

     "selected": ["(string)"],

     "sort": "(string)"

}

And suggests that I will get a response that looks like:

{

      "id": "sample_string_id",

      "name": "12432",

      "description": "",

      "reportSuiteID": "sample_rs_1",

      "owner": "sample_owner",

      "polarity": "positive",

      "precision": 4,

      "type": "decimal",

      "definition": {

           "metric": "visits"

      },

      "tags": [],

      "shares": [{

           "type": "organization",

           "name": "all"

      }],

      "modified": "2015-06-12 09:13:04"

},

So I was able to successfully make a request using:

curl - X POST\ 'https://api.omniture.com/admin/1.4/rest/?method=CalculatedMetrics.Get'\

- H 'Cache-Control: no-cache'\

- H 'Content-Type: application/javascript'\

- H 'X-WSSE: UsernameToken Username=\"abc:deg\", PasswordDigest=\"1k3SlbE4qPhtuwj95Gm+AtGDp7VE85bNNJpByoxyf+I=\", Nonce=\"NjQzYTAwMDQtZTJhMy00MGQ4LTk0MjUtYzY1NmI5YzNhZTQ3\", Created=\"2018-08-28T04:31:40.594Z\", Algorithm=\"SHA256\"'


But I only get the following back:

    {

    "id": "cm200000783_59a50bb498ca3a40244da249",

    "name": "CUG2 Prospects"

    }, {

    "id": "cm200000783_59a50a1bb9b6c36211b58e6b",

    "name": "Mobiles Customers*"

    }, {

    "id": "cm200000783_59a612a205871b726d608d3b",

    "name": "Prospect Visitors"

    }, {

    "id": "cm200000783_59a6261d1a444f048d78a66a",

    "name": "Reset Password Change Error"

    }, {

    "id": "cm200000783_59af5b531a444f048d1855ac",

    "name": "Combo Customers*"

    }, ...

What else can I do so that I get more detail about the calculated metric. Specifically I am interested in the definition field.

Formatting was edited by: Joris de Beer

3 Replies

Avatar

Level 3

Hi Joris,

Did you get any further with this?  I'm having the same issue.

Avatar

Level 3

The answer turns out to be quite simple:  you need to specify the fields that you want to see ('id' and 'name' are the defaults).

So, add "fields":["definition"] to the request.

Avatar

Level 4

Hi Barry,

With some help with ClientCare, I am now able to return a very comprehensive list of Calculated Metrics by posting the following request to: https://api.omniture.com/admin/1.4/rest/?method=CalculatedMetrics.Get

{   "fields": [     "approved",     "description",     "modified",     "reportSuiteID",     "compatibility",     "favorite",     "tags",     "shares",     "owner",     "polarity",     "precision",     "type",     "definition"      ],   "_example": {        "accessLevel": "string",        "fields": [          "approved",          "description",          "modified",          "reportSuiteID",          "compatibility",          "favorite",          "tags",          "shares",          "owner",          "polarity",          "precision",          "type",          "definition"        ],        "filters": {          "name": "string",          "tags": "string",          "owner": "string",          "reportSuiteID": "string",          "approved": true,          "favorite": true        },        "selected": [          "string"        ],        "sort": "string"      } }