আপনার এজেন্সি অ্যাকাউন্টের পারফরম্যান্স ডেটা তৈরি করতে, একটি বিদ্যমান Report টেমপ্লেটের জন্য একটি অ্যাসিঙ্ক্রোনাস অপারেশন শুরু করতে একটি রিপোর্ট চালান।
এই নির্দেশিকায় দেখানো হয়েছে, কীভাবে আপনি এজেন্সি ও ব্র্যান্ডস এপিআই (Agencies & Brands API) ব্যবহার করে একটি Report টেমপ্লেট রান করার মাধ্যমে আপনার এজেন্সি অ্যাকাউন্টের পারফরম্যান্স বর্ণনা করে একটি রিপোর্ট তৈরি করতে পারেন।
শুরু করার আগে
এগিয়ে যাওয়ার আগে, আপনাকে নিম্নলিখিতগুলি অবশ্যই সম্পন্ন করতে হবে:
একটি রিপোর্ট চালানো শুরু করুন
বিদ্যমান কোনো রিপোর্ট চালানোর জন্য, agencies.reports.run মেথডটি ব্যবহার করুন।
নিম্নলিখিত উদাহরণটি একটি রিপোর্ট রান শুরু করার জন্য একটি POST অনুরোধ করে:
বিশ্রাম
অনুরোধ
curl --request POST \
'https://agenciesandbrands.googleapis.com/v1/agencies/ACCOUNT_ID/reports/123456789:run' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{}' \
--compressed
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
-
ACCOUNT_ID: আপনার অ্যাকাউন্ট আইডি। -
ACCESS_TOKEN: আপনার অ্যাক্সেস টোকেন।
প্রতিক্রিয়া
{
"name": "agencies/ACCOUNT_ID/reports/123456789/operations/10486370264",
"done": false,
"metadata": {
"@type": "type.googleapis.com/google.ads.agenciesandbrands.v1.RunReportMetadata"
}
}
জাভা
/* * Copyright (c) 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.google.api.services.samples.agenciesandbrands.v1.agencies.reports; import com.google.api.services.agenciesandbrands.v1.AgenciesAndBrands; import com.google.api.services.agenciesandbrands.v1.model.Operation; import com.google.api.services.agenciesandbrands.v1.model.RunReportRequest; import com.google.api.services.samples.agenciesandbrands.v1.Utils; import java.io.IOException; import java.security.GeneralSecurityException; import net.sourceforge.argparse4j.ArgumentParsers; import net.sourceforge.argparse4j.inf.ArgumentParser; import net.sourceforge.argparse4j.inf.ArgumentParserException; import net.sourceforge.argparse4j.inf.Namespace; public class RunReport { /** * Executes the run operation for a report. * * @param agenciesAndBrandsClient the initialized Agencies & Brands API client. * @param accountId the account ID of the agency that created the report. * @param reportId the resource ID of the report to run. * @throws IOException if the API returns an error. */ public static void execute( AgenciesAndBrands agenciesAndBrandsClient, Long accountId, String reportId) throws IOException { String name = String.format("agencies/%s/reports/%s", accountId, reportId); System.out.printf("Running report with name \"%s\".%n", name); RunReportRequest requestBody = new RunReportRequest(); // Run the specified report to start an asynchronous operation. Operation operation = agenciesAndBrandsClient .agencies() .reports() .run(name, requestBody) .execute(); System.out.println("Successfully initiated report run operation:"); Utils.jsonPrettyPrint(operation); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("RunReport") .build() .defaultHelp(true) .description("Runs a specified report asynchronously, returning an Operation " + "that can be used to track its progress."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the agency that created the report.") .required(true) .type(Long.class); parser .addArgument("-r", "--report_id") .help("The resource ID of the report to run.") .required(true); return parser; } public static void main(String[] args) { ArgumentParser parser = createArgumentParser(); Namespace parsedArgs = null; try { parsedArgs = parser.parseArgs(args); } catch (ArgumentParserException ex) { parser.handleError(ex); System.exit(1); } AgenciesAndBrands client = null; try { client = Utils.getAgenciesAndBrandsClient(); } catch (IOException ex) { System.out.printf("Unable to create Agencies & Brands API service:%n%s", ex); System.out.println("Did you specify a valid path to a service account key file?"); System.exit(1); } catch (GeneralSecurityException ex) { System.out.printf("Unable to establish secure HttpTransport:%n%s", ex); System.exit(1); } try { execute( client, parsedArgs.getLong("account_id"), parsedArgs.getString("report_id")); } catch (IOException ex) { System.out.printf("Agencies & Brands API returned error response:%n%s", ex); System.exit(1); } } }
একটি রিপোর্ট চালানো একটি অ্যাসিঙ্ক্রোনাস দীর্ঘ-চলমান অপারেশন। যখন আপনি run মেথডটি কল করেন, তখন এজেন্সিস অ্যান্ড ব্র্যান্ডস এপিআই একটি Operation রিসোর্স দিয়ে সাড়া দেয়। অপারেশনের name ফিল্ডটি রান অপারেশনটিকে শনাক্ত করে এবং এর ফরম্যাটটি নিম্নরূপ:
agencies/ACCOUNT_ID/reports/REPORT_ID/operations/OPERATION_ID
ফেরত আসা Operation অবজেক্টটিতে নিম্নলিখিত বিষয়গুলো থাকে:
-
name: দীর্ঘ সময় ধরে চলা অপারেশনটির জন্য সার্ভার কর্তৃক নির্ধারিত নাম। REPORT_ID হলো আপনার চালানো রিপোর্ট টেমপ্লেটটির একটি অনন্য শনাক্তকারী। OPERATION_ID হলো একটি অনন্য শনাক্তকারী যা গুগল আপনার তৈরি করা অপারেশনটিকে বরাদ্দ করে, যখন আপনি একটি রিপোর্ট টেমপ্লেট চালান। -
metadata: ঐচ্ছিক পরিষেবা-নির্দিষ্ট অগ্রগতির তথ্য।agencies.reports.runরেসপন্সে আপনি যেOperationঅবজেক্টটি পান, তাতেmetadataফিল্ডটি পূরণ করা নাও থাকতে পারে।
রিপোর্ট চালানো শুরু করার পর, অপারেশনটির ' done ' ফিল্ডের মান ' true ' না হওয়া পর্যন্ত আপনি রিপোর্টের ফলাফল দেখতে পারবেন না। একটি রিপোর্ট চালানো সম্পন্ন হতে যে সময় লাগে, তা রিপোর্টের জটিলতার উপর নির্ভর করে পরিবর্তিত হয়।
পরবর্তী পদক্ষেপ
- এজেন্সি ও ব্র্যান্ডস এপিআই ব্যবহার করে কীভাবে পোল করতে হয় এবং সম্পূর্ণ রিপোর্ট দেখতে হয়, তা জানুন।
- এজেন্সি ও ব্র্যান্ডস এপিআই ব্যবহার করে বিদ্যমান রিপোর্টগুলো কীভাবে দেখতে হয় তা জানুন।