Hello,
Is it possible to specify the format of the date values in the JSON report built using the Adobe Analytics API?
For example, currently date comes in format Month Day, Year. Is it possible to get the date in an ISO 8601 format (Year-Month-Day)?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Gotcha!
Just had a look back at my scripts (using Python) and I did a work around.
AdobeAPIdate = today - timedelta(days = 1)
#CREATE THE ADOBE API DATES WITH ADOBE NAMING LOGIC (E.G. 00 for Jan)
adjust = 1
while adjust < 31:
if ((str(AdobeAPIdate))[5:7]) == '01':
monthshift = '00'
elif ((str(AdobeAPIdate))[5:7]) == '02':
monthshift = '01'
elif ((str(AdobeAPIdate))[5:7]) == '03':
monthshift = '02'
elif ((str(AdobeAPIdate))[5:7]) == '04':
monthshift = '03'
elif ((str(AdobeAPIdate))[5:7]) == '05':
monthshift = '04'
elif ((str(AdobeAPIdate))[5:7]) == '06':
monthshift = '05'
elif ((str(AdobeAPIdate))[5:7]) == '07':
monthshift = '06'
elif ((str(AdobeAPIdate))[5:7]) == '08':
monthshift = '07'
elif ((str(AdobeAPIdate))[5:7]) == '09':
monthshift = '08'
elif ((str(AdobeAPIdate))[5:7]) == '10':
monthshift = '09'
elif ((str(AdobeAPIdate))[5:7]) == '11':
monthshift = '10'
elif ((str(AdobeAPIdate))[5:7]) == '12':
monthshift = '11'
AdobeCustomDates.append((str(1))+((str(AdobeAPIdate))[2:4])+monthshift+((str(AdobeAPIdate))[8:11]))
adjust += 1
AdobeAPIdate = today - timedelta(days = adjust)
Then I used "AdobeAPIdate" as the date for output to SQL / google sheets.
Views
Replies
Total Likes
Yes you can.
Here is bit of the code I use...
body = {
'rsid': 'yourrsid',
'globalFilters': [
{
'type': 'dateRange',
'dateRange': '2021-03-01T00:00:00.000/2021-03-05T00:00:00.000'
}
],
'metricContainer': {
'metrics': [
{
'columnId': 'metrics/event1:::0'..............
I meant on the resulting JSON report.
When using the dimension 'variables/daterangeday', the date values come in the format 'Month Day, Year', for example:
...
"value":"Dec 31, 2017",
...
What I'm looking for here would be so these dates come in ISO 8601 format:
...
"value":"2017-12-31",
...
Views
Replies
Total Likes
Gotcha!
Just had a look back at my scripts (using Python) and I did a work around.
AdobeAPIdate = today - timedelta(days = 1)
#CREATE THE ADOBE API DATES WITH ADOBE NAMING LOGIC (E.G. 00 for Jan)
adjust = 1
while adjust < 31:
if ((str(AdobeAPIdate))[5:7]) == '01':
monthshift = '00'
elif ((str(AdobeAPIdate))[5:7]) == '02':
monthshift = '01'
elif ((str(AdobeAPIdate))[5:7]) == '03':
monthshift = '02'
elif ((str(AdobeAPIdate))[5:7]) == '04':
monthshift = '03'
elif ((str(AdobeAPIdate))[5:7]) == '05':
monthshift = '04'
elif ((str(AdobeAPIdate))[5:7]) == '06':
monthshift = '05'
elif ((str(AdobeAPIdate))[5:7]) == '07':
monthshift = '06'
elif ((str(AdobeAPIdate))[5:7]) == '08':
monthshift = '07'
elif ((str(AdobeAPIdate))[5:7]) == '09':
monthshift = '08'
elif ((str(AdobeAPIdate))[5:7]) == '10':
monthshift = '09'
elif ((str(AdobeAPIdate))[5:7]) == '11':
monthshift = '10'
elif ((str(AdobeAPIdate))[5:7]) == '12':
monthshift = '11'
AdobeCustomDates.append((str(1))+((str(AdobeAPIdate))[2:4])+monthshift+((str(AdobeAPIdate))[8:11]))
adjust += 1
AdobeAPIdate = today - timedelta(days = adjust)
Then I used "AdobeAPIdate" as the date for output to SQL / google sheets.
Views
Replies
Total Likes
Thanks for your example. I also have a way to post-process the date format in the report to the one I want but I was just wondering if there's a way to obtain the intended format directly in the report (through some POST request parameter) without having to apply any transformations.
Views
Replies
Total Likes
Sadly I don't think so.
Do let me know if you find out a way.
@goncalolopes - this has some examples of Analytics API 2.0:
Views
Replies
Total Likes
Is there a section that references defining the date format in the report? Please see my reply above for an example.
Views
Replies
Total Likes
Views
Likes
Replies