Report অবজেক্টটি একটি পুনঃব্যবহারযোগ্য টেমপ্লেট নির্ধারণ করে, যা আপনি তৈরি করতে চান এমন একটি রিপোর্টের বর্ণনা দেয়। Report অবজেক্টটি রিপোর্টের জন্য ডাইমেনশন, মেট্রিক এবং তারিখের পরিসরের মতো মানদণ্ড কনফিগার করে।
এই নির্দেশিকায় বর্ণনা করা হয়েছে কীভাবে আপনি পারফরম্যান্স ট্র্যাক করার জন্য একটি রিপোর্ট তৈরি করতে , আপনার প্রয়োজন অনুসারে বিদ্যমান কোনো রিপোর্ট পরিবর্তন করতে , অথবা অপ্রচলিত কোনো রিপোর্টের টেমপ্লেট মুছে ফেলতে কিউরেশন পার্টনার্স এপিআই (Curation Partners API) ব্যবহার করতে পারেন।
শুরু করার আগে
এগিয়ে যাওয়ার আগে, আপনাকে অবশ্যই প্রমাণীকরণ সেট আপ করতে হবে।
একটি প্রতিবেদন তৈরি করুন
আপনি curators.reports.create মেথডটি ব্যবহার করে একটি রিপোর্ট তৈরি করতে পারেন। একটি রিপোর্ট আপনার রিপোর্টিং কোয়েরিগুলোর জন্য ডাইমেনশন, মেট্রিক, ডেট রেঞ্জ, টাইম জোন, ফিল্টার এবং ডিফল্ট সর্ট কনফিগার করে।
নিম্নলিখিত উদাহরণটি একটি Report অবজেক্ট সম্বলিত JSON বডি সহ curators.reports.create মেথডে একটি POST অনুরোধ পাঠায়:
বিশ্রাম
অনুরোধ
curl --request POST \
'https://curationpartners.googleapis.com/v1/curators/ACCOUNT_ID/reports' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "Monthly Data Segment Performance",
"reportDefinition": {
"dimensions": [
"DATE",
"CURATION_DATA_SEGMENT_ID"
],
"metrics": [
"IMPRESSIONS",
"CLICKS",
"SPEND",
"CURATION_PARTNER_FEE"
],
"dateRange": {
"relative": "LAST_30_DAYS"
},
"timeZoneSource": "UTC"
}
}' \
--compressed
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
-
ACCOUNT_ID: আপনার অ্যাকাউন্ট আইডি -
ACCESS_TOKEN: আপনার অ্যাক্সেস টোকেন
প্রতিক্রিয়া
{
"name": "curators/ACCOUNT_ID/reports/123456789",
"reportId": "123456789",
"displayName": "Monthly Data Segment Performance",
"reportDefinition": {
"dimensions": [
"DATE",
"CURATION_DATA_SEGMENT_ID"
],
"metrics": [
"IMPRESSIONS",
"CLICKS",
"SPEND",
"CURATION_PARTNER_FEE"
],
"dateRange": {
"relative": "LAST_30_DAYS"
},
"timeZoneSource": "UTC"
},
"createTime": "2026-08-01T10:00:00Z",
"updateTime": "2026-08-01T10:00:00Z",
"locale": "en"
}
রিপোর্ট তৈরি করার সময়, আপনাকে অবশ্যই reportDefinition অবজেক্টটি নিম্নলিখিত ফিল্ডগুলো দিয়ে পূরণ করতে হবে:
-
dimensions: আপনার রিপোর্টে মেট্রিকগুলোকে গ্রুপ করার জন্য আপনি যে ডাইমেনশনগুলো ব্যবহার করতে পারেন তার তালিকা, যেমনDATE,CURATION_DATA_SEGMENT_ID,DEAL_ID, বাENVIRONMENT। -
metrics: একত্রিত করার জন্য মেট্রিক্সের তালিকা, যেমনIMPRESSIONS,CLICKS,SPEND, বাCURATION_PARTNER_FEE। -
dateRange: রিপোর্টের জন্য তারিখের পরিসর। তারিখের পরিসরটি রিপোর্ট চালানোর সময়ের সাপেক্ষে একটি পরিসর হিসাবে নির্দিষ্ট করা হয়, যেমনLAST_30_DAYSবাYESTERDAY, অথবাstartDateএবংendDateসহ একটি নির্দিষ্ট পরিসর হিসাবেও নির্ধারণ করা হয়।
আপনি ঐচ্ছিকভাবে নিম্নলিখিত ক্ষেত্রগুলি কনফিগার করতে পারেন:
-
timeZoneSource: রিপোর্টে প্রয়োগ করা টাইম জোনের উৎস। ডিফল্টরূপে এটিAD_EXCHANGEenum ভ্যালু ব্যবহার করে, যা প্যাসিফিক টাইম জোনকে নির্দেশ করে। -
timeZone: একটি IANA টাইম জোন স্ট্রিং—উদাহরণস্বরূপ,"America/New_York"। যখন আপনিtimeZoneSourceফিল্ডটিকেPROVIDEDভ্যালুতে সেট করবেন, তখন আপনাকে অবশ্যই এই ফিল্ডটি পূরণ করতে হবে। -
filters: আপনার নির্দিষ্ট করা ডাইমেনশন বা মেট্রিক মানের মধ্যে রিপোর্টের ডেটা সীমাবদ্ধ করে। sorts: রিপোর্টের ফলাফল সারিগুলোর জন্য ডিফল্ট সর্ট ক্রম।
জাভা
/* * 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; import com.google.api.services.curationpartners.v1.CurationPartners; import com.google.api.services.curationpartners.v1.model.DateRange; import com.google.api.services.curationpartners.v1.model.Report; import com.google.api.services.curationpartners.v1.model.ReportDefinition; import com.google.api.services.samples.curationpartners.v1.Utils; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.List; 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 CreateReport { /** * Executes the create operation for a report. * * @param curationPartnersClient the initialized Curation Partners API client. * @param accountId the account ID of the curator that will create the report. * @param displayName the display name of the report to be created. * @param dimensions the list of dimensions to include in the report definition. * @param metrics the list of metrics to include in the report definition. * @param relativeDateRange the relative date range for the report. * @throws IOException if the API returns an error. */ public static void execute( CurationPartners curationPartnersClient, Long accountId, String displayName, List<String> dimensions, List<String> metrics, String relativeDateRange) throws IOException { String parent = String.format("curators/%s", accountId); System.out.printf("Creating Report \"%s\" for curator with name \"%s\".%n", displayName, parent); ReportDefinition reportDefinition = new ReportDefinition() .setDimensions(dimensions) .setMetrics(metrics) .setDateRange(new DateRange().setRelative(relativeDateRange)); Report newReport = new Report() .setDisplayName(displayName) .setReportDefinition(reportDefinition); // Create a new report. Report createdReport = curationPartnersClient .curators() .reports() .create(parent, newReport) .execute(); System.out.println("Successfully created report:"); Utils.jsonPrettyPrint(createdReport); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("CreateReport") .build() .defaultHelp(true) .description("Creates a new report for the given curator account."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the curator that will create the report.") .required(true) .type(Long.class); parser .addArgument("-d", "--display_name") .help("The display name of the report to be created.") .required(true); parser .addArgument("--dimensions") .help("The space-delimited list of dimensions to include in the report definition " + "(for example: DATE BUYER_NAME). For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#dimension") .required(true) .nargs("+"); parser .addArgument("--metrics") .help("The space-delimited list of metrics to include in the report definition " + "(for example: IMPRESSIONS CLICKS). For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#metric") .required(true) .nargs("+"); // Optional arguments. parser .addArgument("--relative_date_range") .help("The relative date range for the report to include in the report definition. (for example: LAST_7_DAYS, TODAY, YESTERDAY). " + "Defaults to LAST_7_DAYS if unspecified. For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#relativedaterange") .setDefault("LAST_7_DAYS"); 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); } Long accountId = parsedArgs.getLong("account_id"); String displayName = parsedArgs.getString("display_name"); List<String> dimensions = parsedArgs.getList("dimensions"); List<String> metrics = parsedArgs.getList("metrics"); String relativeDateRange = parsedArgs.getString("relative_date_range"); try { execute(client, accountId, displayName, dimensions, metrics, relativeDateRange); } catch (IOException ex) { System.out.printf("Curation Partners API returned error response:%n%s", ex); System.exit(1); } } }
বিদ্যমান প্রতিবেদন পরিবর্তন করুন
বিদ্যমান কোনো রিপোর্ট পরিবর্তন করতে, curators.reports.patch মেথডটি ব্যবহার করুন। কোন কোন ফিল্ড আপডেট করতে হবে তা নির্দিষ্ট করতে, updateMask কোয়েরি প্যারামিটারটি ব্যবহার করুন।
নিম্নলিখিত উদাহরণটি একটি রিপোর্টের প্রদর্শিত নাম এবং আপেক্ষিক তারিখের পরিসর আপডেট করার জন্য একটি PATCH অনুরোধ করে:
বিশ্রাম
অনুরোধ
curl --request PATCH \
'https://curationpartners.googleapis.com/v1/curators/ACCOUNT_ID/reports/123456789?updateMask=displayName,reportDefinition.dateRange.relative' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "Updated Data Segment Performance",
"reportDefinition": {
"dateRange": {
"relative": "THIS_MONTH_TO_DATE"
}
}
}' \
--compressed
প্রতিক্রিয়া
{
"name": "curators/ACCOUNT_ID/reports/123456789",
"reportId": "123456789",
"displayName": "Updated Data Segment Performance",
"reportDefinition": {
"dimensions": [
"DATE",
"CURATION_DATA_SEGMENT_ID"
],
"metrics": [
"IMPRESSIONS",
"CLICKS",
"SPEND",
"CURATION_PARTNER_FEE"
],
"dateRange": {
"relative": "THIS_MONTH_TO_DATE"
},
"timeZoneSource": "UTC"
},
"createTime": "2026-08-01T10:00:00Z",
"updateTime": "2026-08-01T10:10:00Z",
"locale": "en"
}
জাভা
/* * 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; import com.google.api.services.curationpartners.v1.CurationPartners; import com.google.api.services.curationpartners.v1.model.DateRange; import com.google.api.services.curationpartners.v1.model.Report; import com.google.api.services.curationpartners.v1.model.ReportDefinition; import com.google.api.services.samples.curationpartners.v1.Utils; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; 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 PatchReport { private PatchReport() {} /** * Executes the patch operation for a report. * * @param curationPartnersClient the initialized Curation Partners API client. * @param accountId the account ID of the curator that created the report. * @param reportId the resource ID of the report to update. * @param displayName the modified display name for the report (or null if not being modified). * @param relativeDateRange the modified relative date range for the report definition (or null * if not being modified). * @param dimensions the modified list of dimensions for the report definition (or null if not * being modified). * @param metrics the modified list of metrics for the report definition (or null if not being * modified). * @throws IOException if the API returns an error. */ public static void execute( CurationPartners curationPartnersClient, Long accountId, String reportId, String displayName, String relativeDateRange, List<String> dimensions, List<String> metrics) throws IOException { String name = String.format("curators/%d/reports/%s", accountId, reportId); List<String> patchedFields = new ArrayList<>(); Report patchedReport = new Report(); if (displayName != null) { patchedReport.setDisplayName(displayName); patchedFields.add("displayName"); } ReportDefinition reportDefinition = new ReportDefinition(); if (relativeDateRange != null) { reportDefinition.setDateRange(new DateRange().setRelative(relativeDateRange)); patchedFields.add("reportDefinition.dateRange.relative"); } if (dimensions != null) { reportDefinition.setDimensions(dimensions); patchedFields.add("reportDefinition.dimensions"); } if (metrics != null) { reportDefinition.setMetrics(metrics); patchedFields.add("reportDefinition.metrics"); } // Set the ReportDefinition on the patched Report unconditionally. Any fields not // explicitly specified in the updateMask will be ignored by the API. patchedReport.setReportDefinition(reportDefinition); if (patchedFields.isEmpty()) { System.out.println("No fields specified to update."); return; } String updateMask = String.join(",", patchedFields); System.out.printf("Patching report with name \"%s\".%n", name); // Patch the report. Report returnedReport = curationPartnersClient .curators() .reports() .patch(name, patchedReport) .setUpdateMask(updateMask) .execute(); System.out.println("Successfully patched report:"); Utils.jsonPrettyPrint(returnedReport); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("PatchReport") .build() .defaultHelp(true) .description("Updates a specified report."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the curator that created the report.") .required(true) .type(Long.class); parser .addArgument("-r", "--report_id") .help("The resource ID of the report to update.") .required(true); // Optional arguments. parser .addArgument("-d", "--display_name") .help("The modified display name of the report."); parser .addArgument("--relative_date_range") .help("The modified relative date range for the report definition (for example: " + "LAST_7_DAYS, TODAY, YESTERDAY). For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#relativedaterange"); parser .addArgument("--dimensions") .help("A space-delimited list of modified dimensions for the report definition (for " + "example: DATE, BUYER_NAME). For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#dimension") .nargs("+"); parser .addArgument("--metrics") .help("A space-delimited list of modified metrics for the report definition (for " + "example: IMPRESSIONS CLICKS). For a listing of possible values, see: " + "https://developers.google.com/authorized-buyers/curation/apis/curationpartners/reference/rest/v1/curators.reports#metric") .nargs("+"); return parser; } public static void main(String[] args) { ArgumentParser parser = createArgumentParser(); Namespace parsedArgs = null; try { parsedArgs = parser.parseArgs(args); } catch (ArgumentParserException e) { parser.handleError(e); 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); } Long accountId = parsedArgs.getLong("account_id"); String reportId = parsedArgs.getString("report_id"); String displayName = parsedArgs.getString("display_name"); String relativeDateRange = parsedArgs.getString("relative_date_range"); List<String> dimensions = parsedArgs.getList("dimensions"); List<String> metrics = parsedArgs.getList("metrics"); try { execute( client, accountId, reportId, displayName, relativeDateRange, dimensions, metrics); } catch (IOException e) { System.out.printf("Curation Partners API returned error response:%n%s", e); System.exit(1); } } }
একটি রিপোর্ট মুছে ফেলুন
আপনার আর প্রয়োজন নেই এমন কোনো রিপোর্ট মুছে ফেলার জন্য, curators.reports.delete মেথডটি ব্যবহার করুন। একটি রিপোর্ট মুছে ফেলার পর, আপনি ভবিষ্যতে রিপোর্টটি চালানোর জন্য আর সেটি ব্যবহার করতে পারবেন না। এছাড়াও, আপনি curators.reports.get বা curators.reports.list মেথড ব্যবহার করে রিপোর্টটি পুনরুদ্ধার করতে পারবেন না।
নিম্নলিখিত উদাহরণটি নির্দিষ্ট রিপোর্টটি মুছে ফেলার জন্য একটি DELETE অনুরোধ পাঠায়:
বিশ্রাম
অনুরোধ
curl --request DELETE \
'https://curationpartners.googleapis.com/v1/curators/ACCOUNT_ID/reports/123456789' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json' \
--compressed
প্রতিক্রিয়া
{}
জাভা
/* * 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; import com.google.api.services.curationpartners.v1.CurationPartners; 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 DeleteReport { /** * Executes the delete operation for a report. * * @param curationPartnersClient the initialized Curation Partners API client. * @param accountId the account ID of the curator that created the report. * @param reportId the resource ID of the report to delete. * @throws IOException if the API returns an error. */ public static void execute( CurationPartners curationPartnersClient, Long accountId, String reportId) throws IOException { String name = String.format("curators/%s/reports/%s", accountId, reportId); System.out.printf("Deleting report with name \"%s\".%n", name); // Delete the specified report. curationPartnersClient.curators().reports().delete(name).execute(); System.out.println("Successfully deleted report."); } /** * Creates and configures the ArgumentParser for this sample. * * @return the configured ArgumentParser. */ private static ArgumentParser createArgumentParser() { ArgumentParser parser = ArgumentParsers.newFor("DeleteReport") .build() .defaultHelp(true) .description("Deletes a specified report."); // Required arguments. parser .addArgument("-a", "--account_id") .help("The account ID of the curator that created the report.") .required(true) .type(Long.class); parser .addArgument("-r", "--report_id") .help("The resource ID of the report to delete.") .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")); } catch (IOException ex) { System.out.printf("Curation Partners API returned error response:%n%s", ex); System.exit(1); } } }
পরবর্তী পদক্ষেপ
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে কীভাবে রিপোর্ট দেখতে হয় তা জানুন।
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে কীভাবে রিপোর্ট তৈরি করতে হয় তা জানুন।
- কিউরেশন পার্টনার্স এপিআই ব্যবহার করে কীভাবে পোল করতে হয় এবং সম্পূর্ণ রিপোর্ট দেখতে হয় তা জানুন।