একটি রিপোর্ট রান অপারেশন অ্যাসিঙ্ক্রোনাসভাবে একটি দীর্ঘ-চলমান অপারেশন হিসেবে সম্পাদিত হয়, যা Operation অবজেক্ট দ্বারা উপস্থাপিত হয়। একটি রিপোর্ট রান অপারেশনের আউটপুট হলো Report অবজেক্টের উপর ভিত্তি করে প্রাপ্ত রিপোর্টের ফলাফল।
এই নির্দেশিকায় বর্ণনা করা হয়েছে কিভাবে আপনি কিউরেশন পার্টনার্স এপিআই (Curation Partners API) ব্যবহার করে একটি রিপোর্ট রান অপারেশনের স্ট্যাটাস পোল করতে পারেন এবং সম্পন্ন হওয়া রিপোর্ট রান অপারেশনের রিপোর্ট ফলাফল সংগ্রহ করতে পারেন ।
শুরু করার আগে
এগিয়ে যাওয়ার আগে, আপনাকে নিম্নলিখিতগুলি অবশ্যই সম্পন্ন করতে হবে:
- প্রমাণীকরণ সেট আপ করুন ।
- একটি দীর্ঘ-চলমান অপারেশন রিসোর্সের নাম পেতে একটি রিপোর্ট রান শুরু করুন ।
একটি রিপোর্টের জরিপের অবস্থা চালানো হয়েছে
কোনো রিপোর্ট রান অপারেশনের এক্সিকিউশন স্ট্যাটাস চেক করতে, curators.reports.operations.get মেথডটি ব্যবহার করুন।
নিম্নলিখিত উদাহরণটি একটি অপারেশন পোল করার জন্য একটি GET অনুরোধ পাঠায়:
বিশ্রাম
অনুরোধ
curl \
'https://curationpartners.googleapis.com/v1/curators/ACCOUNT_ID/reports/123456789/operations/10486370264' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--compressed
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
-
ACCOUNT_ID: আপনার অ্যাকাউন্ট আইডি। -
ACCESS_TOKEN: আপনার অ্যাক্সেস টোকেন।
প্রতিক্রিয়া
সফলভাবে সম্পন্ন হলে, প্রতিক্রিয়াটি একটি Operation হয় যার done ' ফিল্ডের মান ' true সেট করা থাকে, এবং response পেলোডটি reportResult রিসোর্স নামটি দিয়ে পূরণ করা হয়:
{
"name": "curators/ACCOUNT_ID/reports/123456789/operations/10486370264",
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.ads.curationpartners.v1.RunReportMetadata",
"percentComplete": 100
},
"response": {
"@type": "type.googleapis.com/google.ads.curationpartners.v1.RunReportResponse",
"reportResult": "curators/ACCOUNT_ID/reports/123456789/results/10486370264"
}
}
জাভা
/* * 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.curationpartners.v1.curators.reports.operations; import com.google.api.services.curationpartners.v1.CurationPartners; import com.google.api.services.curationpartners.v1.model.Operation; import com.google.api.services.samples.curationpartners.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 GetReportOperation { /** * Executes the get operation for a report operation. * * @param curationPartnersClient the initialized Curation Partners API client. * @param accountId the account ID of the curator. * @param reportId the resource ID of the report. * @param operationId the resource ID of the report operation. * @throws IOException if the API returns an error. */ public static void execute( CurationPartners curationPartnersClient, Long accountId, String reportId, String operationId) throws IOException { String name = String.format( "curators/%s/reports/%s/operations/%s", accountId, reportId, operationId); System.out.printf("Getting report operation with name \"%s\".%n", name); // Get the status of the report operation. Operation operation = curationPartnersClient .curators() .reports() .operations() .get(name) .execute(); System.out.println("Successfully retrieved report operation:"); Utils.jsonPrettyPrint(operation); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("GetReportOperation") .build() .defaultHelp(true) .description("Gets the status of a long-running report operation. If the " + "operation is done, you can view the report contents with the " + "`curators.reports.results.fetchRows` method."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the curator.") .required(true) .type(Long.class); parser .addArgument("-r", "--report_id") .help("The resource ID of the report.") .required(true); parser .addArgument("-o", "--operation_id") .help("The resource ID of the report operation to retrieve.") .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); } CurationPartners client = null; try { client = Utils.getCurationPartnersClient(); } catch (IOException ex) { System.out.printf("Unable to create Curation Partners 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"), parsedArgs.getString("operation_id")); } catch (IOException ex) { System.out.printf("Curation Partners API returned error response:%n%s", ex); System.exit(1); } } }
অপারেশনের অবস্থা জানতে আপনি কীভাবে done ফিল্ডটি ব্যবহার করতে পারেন, তা নিচে বর্ণনা করা হলো:
- যদি রেসপন্সের
done' ফিল্ডের মানfalseহয়, তাহলে রিপোর্ট রান অপারেশনটি তখনও প্রক্রিয়াধীন থাকে। - যদি রেসপন্সের
done' ফিল্ডের মানtrueহয়, তাহলে রিপোর্ট রান অপারেশনটি সম্পন্ন হয়। রেসপন্স বডিতে থাকাOperation' অবজেক্টটিতে নিম্নলিখিত ফিল্ডগুলোর মধ্যে যেকোনো একটিও থাকে:-
response: এটি নির্দেশ করে যে রিপোর্ট রান অপারেশনটি সফল হয়েছে। এই ফিল্ডটি একটি অবজেক্ট, যাtype.googleapis.com/google.ads.curationpartners.v1.RunReportResponseটাইপে সেট করা একটি@typeফিল্ড দ্বারা পূর্ণ থাকে।RunReportResponseটাইপটি একটিreportResultফিল্ড দ্বারা পূর্ণ থাকে, যাতে সংশ্লিষ্ট রিপোর্টresultনামটি থাকে। -
error: এটি নির্দেশ করে যে রিপোর্ট রান অপারেশনটি সফল হয়নি।errorফিল্ডটিতে একটিStatusঅবজেক্ট থাকে, যা রিপোর্ট রান ব্যর্থ হওয়ার কারণ বর্ণনা করে।
-
একটি সম্পূর্ণ প্রতিবেদন থেকে সারিগুলি আনুন
আপনি curators.reports.results.fetchRows মেথড ব্যবহার করে একটি সম্পন্ন রিপোর্ট রান অপারেশনের বিষয়বস্তু পুনরুদ্ধার করতে পারেন। আপনাকে অবশ্যই রিপোর্ট ফলাফলের জন্য name path প্যারামিটারটি পূরণ করতে হবে, যা হলো একটি সম্পন্ন রিপোর্ট রান অপারেশনের reportResult ফিল্ড থেকে প্রাপ্ত রিসোর্স নেম।
নিম্নলিখিত উদাহরণটি ফলাফলের সারিগুলি আনার জন্য একটি GET অনুরোধ করে:
বিশ্রাম
অনুরোধ
curl \
'https://curationpartners.googleapis.com/v1/curators/ACCOUNT_ID/reports/123456789/results/10486370264:fetchRows?pageSize=1' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--compressed
প্রতিক্রিয়া
{
"rows": [
{
"dimensionValues": [
{
"stringValue": "2026-08-01"
},
{
"stringValue": "segment-1001"
}
],
"metricValueGroups": [
{
"primaryValues": [
{
"intValue": "150000"
},
{
"intValue": "3200"
},
{
"doubleValue": 450.75
},
{
"doubleValue": 45.08
}
]
}
]
}
],
"runTime": "2026-08-05T12:00:00Z",
"dateRanges": [
{
"startDate": {
"year": 2026,
"month": 7,
"day": 6
},
"endDate": {
"year": 2026,
"month": 8,
"day": 4
}
}
],
"totalRowCount": 2,
"nextPageToken": "QC7nzW91c2VTcGFubmVyQ29udGlubWF0aW6uVG9wZY45NP=="
}
জাভা
/* * 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.curationpartners.v1.curators.reports.results; import com.google.api.services.curationpartners.v1.CurationPartners; import com.google.api.services.curationpartners.v1.model.FetchReportResultRowsResponse; import com.google.api.services.samples.curationpartners.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 FetchReportResultRows { /** * Executes the fetchRows operation for report result rows. * * @param curationPartnersClient the initialized Curation Partners API client. * @param accountId the account ID of the curator. * @param reportId the resource ID of the report. * @param resultId the resource ID of the report result. * @param pageSize the maximum number of rows to return per page. * @param pageToken the page token from a previous response, if any. * @throws IOException if the API returns an error. */ public static void execute( CurationPartners curationPartnersClient, Long accountId, String reportId, String resultId, Integer pageSize, String pageToken) throws IOException { String name = String.format("curators/%s/reports/%s/results/%s", accountId, reportId, resultId); System.out.printf("Fetching report result rows for \"%s\".%n", name); CurationPartners.Curators.Reports.Results.FetchRows request = curationPartnersClient.curators().reports().results().fetchRows(name); if (pageSize != null) { request.setPageSize(pageSize); } if (pageToken != null) { request.setPageToken(pageToken); } FetchReportResultRowsResponse response = request.execute(); System.out.println("Successfully fetched report result rows:"); Utils.jsonPrettyPrint(response); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("FetchReportResultRows") .build() .defaultHelp(true) .description("Fetches rows for a completed report result."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the curator.") .required(true) .type(Long.class); parser .addArgument("-r", "--report_id") .help("The resource ID of the report.") .required(true); parser .addArgument("--result_id") .help("The resource ID of the report result. This is identical to the resource ID of " + "the corresponding report run operation.") .required(true); // Optional arguments. parser .addArgument("--page_size") .help("The maximum number of rows to return per page.") .type(Integer.class); parser .addArgument("--page_token") .help("A page token, received from a previous `FetchReportResultRows` call."); 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); } CurationPartners client = null; try { client = Utils.getCurationPartnersClient(); } catch (IOException ex) { System.out.printf("Unable to create Curation Partners 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"), parsedArgs.getString("result_id"), parsedArgs.getInt("page_size"), parsedArgs.getString("page_token")); } catch (IOException ex) { System.out.printf("Curation Partners API returned error response:%n%s", ex); System.exit(1); } } }
আপনি নিম্নলিখিত কোয়েরি প্যারামিটারগুলো নির্দিষ্ট করতে পারেন:
-
pageSize: ফেরত দেওয়া সারির সর্বোচ্চ সংখ্যা। ডিফল্ট হলো ১,০০০ সারি এবং সর্বোচ্চ হলো ১০,০০০ সারি। -
pageToken: পরবর্তী সারিগুলো আনার জন্য পূর্ববর্তীfetchRowsরেসপন্সে ফেরত আসা পেজ টোকেন।
প্রতিক্রিয়াটিতে নিম্নলিখিত ক্ষেত্রগুলি রয়েছে:
-
rows:Rowঅবজেক্টের একটি অ্যারে। প্রতিটি সারিতে রয়েছে:-
dimensionValues: অনুরোধকৃত প্রতিটি ডাইমেনশনের মান, যা রিপোর্ট ডেফিনিশনের ডাইমেনশনগুলোর মতোই একই ক্রমে সাজানো। -
metricValueGroups: তারিখের পরিসর অনুযায়ী মেট্রিক মানগুলির গ্রুপ। প্রতিটি গ্রুপে একটিprimaryValuesতালিকা থাকে, যা রিপোর্ট সংজ্ঞার মেট্রিকগুলির মতোই একই ক্রমে সাজানো থাকে।
-
-
dateRanges: রিপোর্টের জন্য গণনাকৃত নির্দিষ্ট তারিখের পরিসর।dateRangesফিল্ডটি শুধুমাত্র প্রথম পৃষ্ঠার রেসপন্স বডিতে অন্তর্ভুক্ত থাকে। -
totalRowCount: রিপোর্টের ফলাফলে থাকা মোট সারির সংখ্যা।totalRowCountফিল্ডটি শুধুমাত্র প্রথম পৃষ্ঠার রেসপন্স বডিতে অন্তর্ভুক্ত থাকে। -
nextPageToken: সারিগুলির পরবর্তী পৃষ্ঠা পুনরুদ্ধার করার জন্য পরবর্তী অনুরোধগুলিতে যে টোকেনটি পাস করতে হবে। যদি কোনো অতিরিক্ত সারি না থাকে, তাহলে কিউরেশন পার্টনার্স এপিআই রেসপন্স বডি থেকে এই ফিল্ডটি বাদ দেয়।
curators.reports.results.fetchRows REST উদাহরণটিতে, rows এর প্রতিটি আইটেম রিপোর্টে কনফিগার করা ReportDefinition সাথে সরাসরি ম্যাপ করা থাকে:
-
dimensionValues: এতেreportDefinition.dimensionsফিল্ডের প্রতিটি ডাইমেনশনের সাথে সম্পর্কিত মানগুলো আপনার নির্দিষ্ট করা সঠিক ক্রমানুসারে থাকে। উদাহরণস্বরূপ, প্রথম মান2026-08-01হলোDATEডাইমেনশনের এবং দ্বিতীয় মানsegment-1001হলোCURATION_DATA_SEGMENT_IDডাইমেনশনের। metricValueGroups: এতে রিপোর্টের তারিখের পরিসর অনুযায়ী মেট্রিকের মানগুলো গ্রুপ করা থাকে। প্রতিটি গ্রুপে,primaryValuesফিল্ডটিতেreportDefinition.metricsফিল্ডের প্রতিটি মেট্রিকের সাথে সম্পর্কিত মানগুলো আপনার নির্দিষ্ট করা সঠিক ক্রমে থাকে। এই উদাহরণে, চারটি মান নিম্নলিখিতMetricenum মানগুলোর সাথে সম্পর্কিত:-
IMPRESSIONS:150000 -
CLICKS:3200 -
SPEND:450.75 -
CURATION_PARTNER_FEE:45.08
-
dateRanges: এতে সেই নির্দিষ্ট তারিখের পরিসর থাকে যা গুগল রিপোর্ট সংজ্ঞায় কনফিগার করাTHIS_MONTH_TO_DATEনামক আপেক্ষিক পরিসরের জন্য গণনা করেছে।
পরবর্তী পদক্ষেপ
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে কীভাবে রিপোর্ট তৈরি ও পরিবর্তন করতে হয় তা জানুন।
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে বিদ্যমান রিপোর্টগুলো কীভাবে দেখতে হয় তা জানুন।
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে কীভাবে রিপোর্ট তৈরি করতে হয় তা জানুন।