Run Reports Via API

Introduction

You can run any of your Rakuten Advertising reports, both standard and customized, via the Reporting API. This allows you to run reports without logging in to your account.

Instructions

Follow these steps to get the API URL for your reports:

  1. Access the Reporting Interface.
  2. Select a standard report from the Choose Reports drop-down menu or build your own.
  3. Set a date range for your report.
  4. If you want to customize the report further, apply filters or add or remove metrics and data points columns, then click Save Report.
  5. Click the arrow next to View Report and select Get API:

    Menu options including "Get API" highlighted.

  6. A Get API URL pop-up appears. It displays a URL that includes your web token. Copy the API URL and save it in a safe place.

 Caution

Your API URL features a token that allows you to access your reporting data without logging in to your account. You should keep it as securely as you would your username and password. See the API URL section below for more information on the token parameter.

Application

You can paste the API URL into any browser at any time to generate your report without needing to access the Reporting Interface. The CSV file with your report data will download to your computer. CSV files can be opened in Excel.

API URL

You can modify existing API parameters you are currently using or build new reporting API URLs without returning to the Reporting Interface. This is an example API URL:

https://ran-reporting.rakutenmarketing.com/en/reports/revenue-report-by-day/filters?start_date=20XX-10-25&end_date=20XX-10-26&include_summary=Y&network=1&previous-start-date=20XX-09-25& previous-end-date=20XX-09-26&tz=GMT&date_type=process&date_format=m-d-yy&token=xxxxxxx

You can edit the parts shown in green. Click the + next to each parameter name for more information:

Primary start date
Text displayed: start_date=20XX-01-01

Description: This sets the start date for the first date range in your report. Use the format YYYY-MM-DD.

Primary end date
Text displayed: end_date=20XX-07-21

Description: This sets the end date for the first date range in your report. Use the format YYYY-MM-DD.

Include summary
Text displayed: include_summary=Y

Description: Set this to Y if you want the summary section at the top of the report file. Set this to N if you do not. By default, it is set to Y.

Network
Text displayed: network=

Description: Use this setting to show data for only one network. This prevents different currencies from appearing in the same report. Use these values for each network:

  • US = 1
  • UK = 3
  • CA = 5
  • BR = 8
  • AU = 41
  • FR = 7
  • DE = 9
  • JP = 11
Previous start date
Text displayed: previous_start_date=20XX-01-01

Description: This sets the start date for the second date range in your report. Use the format YYYY-MM-DD.

Previous end date
Text displayed: previous_end_date=20XX-07-21

Description: This sets the end date for the second date range in your report. Use the format YYYY-MM-DD.

Time zone
Text displayed: tz=GMT

Description: This sets the time zone the report uses. GMT is the default time zone. When you select dates in the Reporting Interface, the time zone you choose appears in the API URL. Learn more about customizing the time zone for your report.

Date type
Text displayed: date_type=process

Description: This sets the type of date used in the report. Use process for the Process Date and transaction for the Transaction Date.

Date format
Text displayed: date_format=XXXX/XX/XX

Description: This setting is optional and has default values. Use one of the options below to format the dates in your report. If you do not specify a format, the default is m/d/yy for most networks and yyyy/mm/dd for the Japan network. The options you can use are:

  • m/d/YY
  • YYYY/mm/dd
  • mm/dd/YY
  • dd/mm/YY
  • dd/mm/YYYY
  • m-d-yy
  • YYYY-mm-dd
  • mm-dd-YY
  • dd-mm-YY
  • dd-mm-YYYY
Token
Text displayed: token=xxxxxxxxxx

Description: This token keeps your data secure. Keep your token safe and do not send it to anyone in an email. If you need a new token, click Update API Token in the top right corner of any report in the interface.

Preset Date Ranges

You can use exact start and end dates and preset date ranges in the API URL. Using preset date ranges saves you from having to calculate the specific dates for your API calls. When you select a preset date range from the drop-down menu in the Reporting Interface, the Get API URL uses that preset value as follows:

Preset Date Range Values for date_range parameter
Yesterday yesterday
Last 7 Days last-7-days
This Month this-month
Last Month last-month
This Quarter this-quarter
Last Quarter last-quarter
This Year this-year
Last Year last-year

When you compare your report to another period, you can use these values for the previous_date_range:

Date Range Date Range Values
Previous Week previous-week
Previous Month previous-month
Previous Quarter previous-quarter
Previous Year previous-year

If you select a custom date range using the date picker in the Reporting Interface, the API URL will show the specific dates. For example, if you select a custom date range with April 22, 20XX as the start date and May 5, 20XX as the end date, the URL will include:

/filters?start_date=20XX-04-22&end_date=20XX-05-05

The selected time zone offset will be applied to your report. Dates and Times will only reflect the time zone for the Transaction Date, Transaction Time, Process Date, and Process Time columns.

The time zone offset will be applied to reports that do not include these columns, like the Sales and Activity Report. Reports that do include these columns, like the Individual Item Report, will also have the time zone offset applied as seen in the converted Transaction Date and Time.

However, the time zone conversion is not done for the following Date and Time columns:

  • Booking Consumed Date
  • Click Date
  • Order Ship Date
  • Signature Match Date
  • Signature Match Time
  • Transaction Created On Date
  • Transaction Created On Time

Date Format Parameter

This parameter is optional and has default values. You can enter the date_format parameter values in the Get API URL. You can use either encoded or non-encoded values.

 Attention

Depending on your computer's settings, programs like Excel might not support or might change the date format you set in the API URL. You may need to adjust your program settings to help our date format parameter.

API Limit

You can only run one reporting API call at a time. If you send more than one request simultaneously, you will get an error on the extra requests and on all further requests until one or more of your existing requests are complete. The error is an HTTP 429 response with the message You have exceeded your request limits for this session please try again later.

If you use scripts to run API calls, make sure your script does not try to run multiple calls simultaneously. For example, avoid using threaded loops that make unlimited calls. If you must make many calls, add a pause or a limit in your code between requests.

API Errors

You may receive an error code or message as you run your reports via API. View examples of possible API errors and instructions for how to address them. For additional assistance with API errors, contact Customer Support.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.