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

Rest API - CSV format export

Avatar

Level 1

Hi,

According to the documentation here -> Making Reporting API Requests | Adobe Developer Connection ,​ I should be able to add a "format" parameter to the Report.Get method so that I can receive a CSV export.

However I can't get this to work. Is this now deprecated?

Regards,

Vitor Lopes

1 Accepted Solution

Avatar

Correct answer by
Level 9

When you say "I can't get this to work", can you clarify?  For example, do you get a response but it is not csv format? Do you get an error response (e.g. report not ready, or some other thing like missing dateTo or whatever) ? What API version are you using?  Did you specify "source":"warehouse" in it? Did you specify a date range.. that has already passed (if you specify a date range that ends in the future, the report won't be pushed to data warehouse queue until the end of the date range!)

In any case, I did a test and it worked for me. Here is an example for what I did, using API v1.4

First, using Report.Queue

{

    "reportDescription":{

        "reportSuiteID":"myrsidhere",

        "dateFrom":"2017-11-01",

        "dateTo":"2017-11-30",

        "metrics":[

            {

                "id":"pageViews"

            }

        ],

        "elements":[

            {

                "id":"page",

                "top":"5"

            }

        ],

        "source":"warehouse"

    }

}

Which returns e.g.

{

    "reportID":1234567890

}

Then, using Report.Get

{

    "reportID":1234567890,

    "format":"csv"

}

Note: You will not immediately get data returned. If the report is not ready, the API will respond with an error message stating the report is not ready yet.  Data Warehouse report requests generally take longer to be ready than normal report requests, because in addition to the API's queue, Data Warehouse has its own queue based on scheduled DW exports (easiest to check in the DW interface to get an idea about that).

In addition, Data Warehouse will not begin process of completing the report until the ending date in your date range has passed. So for example, you can specify a date range for all of December (this current month) for a normal Report request, and the API will return the data collected so far for the month. But if you attempt to do the same thing for a DW report, DW will not start the process of building the report until January 1st next month!

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

When you say "I can't get this to work", can you clarify?  For example, do you get a response but it is not csv format? Do you get an error response (e.g. report not ready, or some other thing like missing dateTo or whatever) ? What API version are you using?  Did you specify "source":"warehouse" in it? Did you specify a date range.. that has already passed (if you specify a date range that ends in the future, the report won't be pushed to data warehouse queue until the end of the date range!)

In any case, I did a test and it worked for me. Here is an example for what I did, using API v1.4

First, using Report.Queue

{

    "reportDescription":{

        "reportSuiteID":"myrsidhere",

        "dateFrom":"2017-11-01",

        "dateTo":"2017-11-30",

        "metrics":[

            {

                "id":"pageViews"

            }

        ],

        "elements":[

            {

                "id":"page",

                "top":"5"

            }

        ],

        "source":"warehouse"

    }

}

Which returns e.g.

{

    "reportID":1234567890

}

Then, using Report.Get

{

    "reportID":1234567890,

    "format":"csv"

}

Note: You will not immediately get data returned. If the report is not ready, the API will respond with an error message stating the report is not ready yet.  Data Warehouse report requests generally take longer to be ready than normal report requests, because in addition to the API's queue, Data Warehouse has its own queue based on scheduled DW exports (easiest to check in the DW interface to get an idea about that).

In addition, Data Warehouse will not begin process of completing the report until the ending date in your date range has passed. So for example, you can specify a date range for all of December (this current month) for a normal Report request, and the API will return the data collected so far for the month. But if you attempt to do the same thing for a DW report, DW will not start the process of building the report until January 1st next month!

Avatar

Level 1

Hi Josh,

Many thanks for you reply, and all the additional info. I was missing the "source":"warehouse" parameter, and I was only getting a response in JSON.

I do however, need to use calculated metrics, which I can't in warehouse. Is there a any to export CSV without using warehouse?

Once again, many thanks.

Regards,

V

Avatar

Level 9

Not that I'm aware of. I made actual efforts to look for something like that about a year ago and could not find one, and I just did a quickish check again and still doesn't look like it