Issue with Campaign Management Report API

Karthik YR 0 Reputation points
2024-11-27T07:06:31.58+00:00

We are facing issue with microsoft advertising reporting api. I am trying to call campaign management reporting api with below request.

Request ::

{
    "reportRequest": {
        "type": "CampaignPerformanceReportRequest",
        "excludeColumnHeaders": false,
        "excludeReportFooter": false,
        "excludeReportHeader": false,
        "format": "Csv",
        "formatVersion": "2.0",
        "reportName": "My report",
        "returnOnlyCompleteData": true,
        "aggregation": "Daily",
        "columns": {
            "campaignPerformanceReportColumns": [
                "TimePeriod",
                "AccountName",
                "AccountId",
                "CampaignName",
                "CampaignId",
                "Impressions",
                "Clicks",
                "Conversions",
                "Spend"
            ]
        },
        "scope": {
            "accountIds": null,
            "campaigns": {
                "campaignReportScopes": [
                    {
                        "accountId": 176063935,
                        "campaignId": 518714578
                    }
                ]
            }
        },
        "time": {
            "customDateRangeEnd": {
                "day": 15,
                "month": 11,
                "year": 2024
            },
            "customDateRangeStart": {
                "day": 15,
                "month": 1,
                "year": 2024
            },
            "predefinedTime": "ChennaiKolkataMumbaiNewDelhi",
            "reportTimeZone": "ChennaiKolkataMumbaiNewDelhi"
        }
    },
    "resultFileDirectory": "/home/administrator/workspace/microsoft-ads-etl/abc.txt",
    "resultFileName": "abc.txt",
    "overwriteResultFile": true
}


Response ::

{
    "OperationErrors": [
        {
            "Code": 100,
            "ErrorCode": "NullRequest",
            "Details": null,
            "Message": "The request message is null."
        }
    ],
    "BatchErrors": [],
    "TrackingId": "85b5e9fb-355e-4960-86a5-0dae799b6734",
    "Type": "ApiFaultDetail"
}


Need help here, as the response received is not very clear about the error.
Thanks in advance.

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
437 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ChrisWilson00 5 Reputation points
    2024-12-04T19:04:43.46+00:00

    The error message "The request message is null" with ErrorCode: NullRequest indicates that the request body may be incomplete or improperly formatted when sent to the Microsoft Advertising Campaign Management API. This typically happens when the API expects certain data to be passed but it’s missing or malformed. Here are a few things you can check to resolve this:

    Check the structure of the request body: The reportRequest field should be fully populated with valid values. Ensure that all required fields (such as accountIds, campaignId, and time) are correctly set and not null unless optional.

    Ensure accountIds is properly set: Your request has "accountIds": null in the scope field, which might be causing the issue. If you're targeting specific accounts, you need to pass an array with valid account IDs or omit it entirely if not needed.

    Verify Campaign IDs: Check the validity of the campaignId and accountId in the campaignReportScopes array. Ensure that these values exist in the account you're querying against.

    Check the time fields: You are using both a custom date range and a predefined time ("predefinedTime": "ChennaiKolkataMumbaiNewDelhi"). Make sure that the time zone and date range are correctly specified and compatible.

    Validate the request format: Ensure that the API expects the fields as you've structured them (e.g., columns, aggregation, etc.) and that no required fields are missing.

    If everything looks good but the error persists, you may want to review API documentation for any required changes or updates regarding data formats or parameters. You can also check Microsoft’s API forums or contact their support for more detailed guidance.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.