সিঙ্ক্রোনাস অনুরোধ

নতুন Search Ads 360 Reporting API এখন উপলব্ধ। নতুন API কাস্টম রিপোর্ট তৈরি করতে এবং আপনার রিপোর্টিং অ্যাপ্লিকেশন এবং প্রক্রিয়াগুলিতে ডেটা সংহত করার জন্য উন্নত নমনীয়তা প্রদান করে। নতুন Search Ads 360 Reporting API- এ স্থানান্তরিত ও ব্যবহার সম্পর্কে আরও জানুন।

আপনি যদি ছোট থেকে মাঝারি বিজ্ঞাপনদাতা বা ইঞ্জিন-অ্যাকাউন্ট রিপোর্টের জন্য অনুরোধ করেন, আপনি শুধুমাত্র একটি একক, সিঙ্ক্রোনাস রিপোর্টের অনুরোধ পাঠাতে পারেন। অনুরোধের জবাবে, সার্চ বিজ্ঞাপন 360 এপিআই একটি JSON অবজেক্টে পুরো রিপোর্টটি ফিরিয়ে দেবে। সিঙ্ক্রোনাস অনুরোধ:

আপনি যদি বড় বিজ্ঞাপনদাতা বা ইঞ্জিন-অ্যাকাউন্ট রিপোর্টের জন্য অনুরোধ করেন, আমরা অ্যাসিঙ্ক্রোনাস পদ্ধতির সুপারিশ করি৷

একটি সিঙ্ক্রোনাস অনুরোধ করতে

আপনার বিজ্ঞাপনদাতা বা ইঞ্জিন অ্যাকাউন্ট রিপোর্টে আপনি যে ধরনের ডেটা চান তা উল্লেখ করতে Reports.generate() এ কল করুন।

Search Ads 360 অনুরোধটি যাচাই করে, রিপোর্ট তৈরি করে এবং প্রতিক্রিয়া বডিতে রিপোর্ট রিসোর্স হিসেবে রিপোর্ট ফেরত দেয়।

সিঙ্ক্রোনাস অনুরোধের উদাহরণ

নিম্নলিখিত একটি উদাহরণ Reports.generate() অনুরোধ.

JSON

POST  https://www.googleapis.com/doubleclicksearch/v2/reports/generate
Authorization: Bearer your OAuth 2.0 access token
Content-type: application/json

{
  "reportScope": {
    "agencyId": "12300000000000456", // Replace with your ID
    "advertiserId": "21700000000011523", // Replace with your ID
    "engineAccountId": "700000000073991" // Replace with your ID
  },
  "reportType": "account",              // This report covers all revenue and visits in the
                                        // engine account specified in reportScope.
  "columns": [
    { "columnName": "date" },           // The date column segments the report by individual days.

    { "columnName": "dfaRevenue" },     // Here are some metric columns available for keyword
    {                                   // reports.
      "columnName": "visits",
      "startDate": "2013-01-01",        // Each metric column can optionally specify its own start 
      "endDate": "2013-01-31",          // and end date; by default the report timeRange is used.
      "headerText": "January visits"    // Every column can optionally specify a headerText, which
                                        // changes the name of the column in the report.
    }
  ],
  "timeRange" : {
    "startDate" : "2012-05-01",         // Dates are inclusive and specified in YYYY-MM-DD format.
    "endDate" : "2013-05-01"

    // Alternatively, try the "changedMetricsSinceTimestamp" or "changedAttributesSinceTimestamp"
    // options. See Incremental reports.

  },
  "statisticsCurrency": "agency",       // Required. See Currency for statistics.
  "verifySingleTimeZone": false,        // Optional. Defaults to false. See Time zone.
  "includeRemovedEntities": false           // Optional. Defaults to false.
}
        

জাভা

  public static void main(String[] args) throws Exception {
    Doubleclicksearch service = getService(); // See Set Up Your Application.
    Report report = generateAccountReport(service);
    outputReport(report, "./");
  }

  /**
   * Creates an account report using the synchronous Report.generate method.
   *
   * @throws IOException
   */
  private static Report generateAccountReport(Doubleclicksearch service) throws IOException {
    try {
      return service.reports().generate(generateAccountRequest()).execute();
    } catch (GoogleJsonResponseException e) {
      System.err.println("Report request was rejected.");
      for (ErrorInfo error : e.getDetails().getErrors()) {
        System.err.println(error.getMessage());
      }
      System.exit(e.getStatusCode());
      return null; // Unreachable code.
    }
  }

  /**
   * Creates a simple static request that lists the clicks and visits for an engine account. Use
   * your own agency ID, advertiser ID, and engine account ID.
   */
  private static ReportRequest generateAccountRequest() {
    return new ReportRequest().setReportScope(
      new ReportScope()
        .setAgencyId(20700000000000451L) // Replace with your ID
        .setAdvertiserId(21700000000010391L) // Replace with your ID
        .setEngineAccountId(700000000042201L)) // Replace with your ID
        .setReportType("account")
        .setColumns(Arrays.asList(new ReportApiColumnSpec[] {
            new ReportApiColumnSpec().setColumnName("date"),
            new ReportApiColumnSpec().setColumnName("dfaRevenue"),
            new ReportApiColumnSpec()
                .setColumnName("visits")
                .setHeaderText("January visits")
                .setStartDate("2013-01-01")
                .setEndDate("2013-01-31"),}))
        .setTimeRange(new TimeRange()
          .setStartDate("2012-05-01")
          .setEndDate("2013-05-01"))
        .setStatisticsCurrency("agency");
  }

  /**
   * Outputs a synchronous report to a file.
   */
  private static void outputReport(Report report, String localPath)
      throws IOException {
    FileOutputStream outputStream = new FileOutputStream(new File(localPath, "Report"));
    final PrintStream printStream = new PrintStream(outputStream);
    printStream.print(report);
    printStream.close();
  }
        

পাইথন

def generate_report(service):
  """Generate and print sample report.

  Args:
    service: An authorized Doubleclicksearch service.  See Set Up Your Application.
  """
  request = service.reports().generate(
      body=
      {
        "reportScope
            "agencyId": "12300000000000456", // Replace with your ID
            "advertiserId": "21700000000011523", // Replace with your ID
            "engineAccountId": "700000000073991" // Replace with your ID
            },
        "reportType": "account",
        "columns": [
            { "columnName": "date" },
            { "columnName": "dfaRevenue" },
            {
              "columnName": "visits",
              "startDate": "2013-01-01",
              "endDate": "2013-01-31",
              "headerText": "January visits"
             }
        ],
        "timeRange" : {
            "startDate" : "2012-05-01",
            "endDate" : "2013-05-01"
        },
        "statisticsCurrency": "agency",
        "verifySingleTimeZone": "false",
        "includeRemovedEntities": "false"
        }
  )

  pprint.pprint(request.execute())

উদাহরণ রিপোর্ট

একটি সিঙ্ক্রোনাস অনুরোধের প্রতিক্রিয়া একটি রিপোর্ট অবজেক্ট। অনুরোধটি সফলভাবে যাচাই করা হলে, অবজেক্টের প্রথম কয়েকটি বৈশিষ্ট্যে মেটাডেটা থাকে যা আপনার জমা দেওয়া অনুরোধের বর্ণনা দেয়। প্রতিবেদনটি নিজেই বস্তুর rows সম্পত্তিতে রয়েছে।

{
  "kind":"doubleclicksearch#report",
  "request":{
    "columns":[
      {"columnName":"date"},
      {"columnName":"dfaRevenue"},
      {"columnName":"visits","endDate":"2013-01-31","headerText":"visits last month","startDate":"2013-01-01"}
    ],
    "includeDeletedEntities":false,
    "reportScope":{
      "agencyId":"12300000000000456",
      "advertiserId":"21700000000011523",
      "engineAccountId":"700000000073991"
     },
    "reportType":"account",
    "rowCount":10000,
    "startRow":0,
    "statisticsCurrency":"agency",
    "timeRange":{
      "endDate":"2013-05-01",
      "startDate":"2012-05-01"
     }
  },
  "rowCount":366,
  "rows":[
    {
      "date":"2012-05-01",
      "dfaRevenue":0.0,
      "visits last month":0.0
    },
    {
      "date":"2012-05-02",
      "dfaRevenue":0.0,
      "visits last month":0.0
    },
    {
      "date":"2012-05-03",
      "dfaRevenue":0.0,
      "visits last month":0.0
    },
    {
      "date":"2012-05-04",
      "dfaRevenue":0.0,
      "visits last month":0.0
     },
     ...
  ]
}
        

যদি বৈধতা ব্যর্থ হয়

যদি রিপোর্টটি যাচাইকরণ না করে, তাহলে Search Ads 360 একটি ত্রুটির বস্তু সহ HTTP 400 প্রতিক্রিয়া প্রদান করে। উদাহরণস্বরূপ, উপরের উদাহরণ অনুরোধটি একটি বাস্তব সংস্থা নির্দিষ্ট করেনি:

{
 "error": {
   "code": 400,
   "message": "statisticsCurrency: the agency in scope does not have a valid currency. Please make sure the agency is properly initialized in Search Ads 360."
 }
}

সিঙ্ক্রোনাস রিপোর্টকে একাধিক প্রতিক্রিয়ায় বিভক্ত করা

ডিফল্টরূপে, একটি সিঙ্ক্রোনাস অনুরোধ প্রথম 10000 সারি প্রদান করে। সেই আচরণটি পরিবর্তন করতে, প্রতিটি অনুরোধের সাথে প্রতিবেদনের নির্দিষ্ট অংশগুলি পুনরুদ্ধার করতে Reports.request.startRow এবং Reports.request.rowCount বৈশিষ্ট্যগুলি ব্যবহার করুন৷

একটি সিঙ্ক্রোনাস রিপোর্ট বিভক্ত করার উদাহরণ

উদাহরণস্বরূপ, এই অনুরোধটি একটি এজেন্সি রিপোর্টের প্রথম শত সারি (0 থেকে 99) ফেরত দেবে যা দিনে ভাগ করা হয়েছে:

{
  "reportScope": {
    "agencyId": "12300000000000456", // Replace with your ID
    "advertiserId": "21700000000011523", // Replace with your ID
    "engineAccountId": "700000000073991" // Replace with your ID
  },
  "reportType": "account",
  "columns": [
    { "columnName": "date" },
    { "columnName": "dfaRevenue" }
  ],
  "timeRange" : {
    "startDate" : "2012-05-01",
    "endDate" : "2013-05-01"
  },
  "startRow":"0",
  "rowCount":"100",
  "statisticsCurrency": "agency",
  "verifySingleTimeZone": false,
  "includeRemovedEntities": false
}
    

আপনি 100 থেকে 199 সারিগুলির জন্য অন্য অনুরোধের সাথে এই অনুরোধটি অনুসরণ করতে পারেন:

{
  "reportScope": {
    "agencyId": "12300000000000456", // Replace with your ID
    "advertiserId": "21700000000011523", // Replace with your ID
    "engineAccountId": "700000000073991" // Replace with your ID
  },
  "reportType": "account",
  "columns": [
    { "columnName": "date" },
    { "columnName": "dfaRevenue" }
  ],
  "timeRange" : {
    "startDate" : "2012-05-01",
    "endDate" : "2013-05-01"
  },
  "startRow":"100",
  "rowCount":"100",
  "statisticsCurrency": "agency",
  "verifySingleTimeZone": false,
  "includeRemovedEntities": false
}