নির্বাচিত প্যাকেজগুলি সক্রিয় এবং নিষ্ক্রিয় করুন

এই নির্দেশিকায় আপনার বাছাই করা প্যাকেজগুলোর কোনো একটি সক্রিয় বা নিষ্ক্রিয় করার পদ্ধতিগুলো বর্ণনা করা হয়েছে।

একটি কিউরেটেড প্যাকেজ সক্রিয় করুন

আপনার কিউরেটেড প্যাকেজগুলোর একটি সক্রিয় করতে, curators.curatedPackages.activate মেথডটি ব্যবহার করুন। সাবস্ক্রাইব করা মিডিয়া প্ল্যানাররা একটি রিয়েল-টাইম বিডিং বিড রিকোয়েস্ট পান, যাতে আপনার সক্রিয় কিউরেটেড প্যাকেজের টার্গেট করা ইনভেন্টরির জন্য তার curatedPackageId অন্তর্ভুক্ত থাকে।

নিম্নলিখিত উদাহরণটি এপিআই এন্ডপয়েন্টে একটি POST অনুরোধ পাঠায় যা নির্দিষ্ট কিউরেটেড প্যাকেজটি সক্রিয় করে:

বিশ্রাম

অনুরোধ

POST https://authorizedbuyersmarketplace.googleapis.com/v1beta/curators/[YOUR_ACCOUNT_ID]/curatedPackages/123456789:activate?alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{}

প্রতিক্রিয়া

{
 "name": "curators/[YOUR_ACCOUNT_ID]/curatedPackages/123456789",
 "displayName": "Premium Mobile Web Package",
 "description": "High-performing mobile web inventory for premium brands.",
 "createTime": "2026-06-01T16:00:00Z",
 "updateTime": "2026-06-01T16:20:00Z",
 "floorPriceCpm": {
   "currencyCode": "USD",
   "units": "2",
   "nanos": 500000000
 },
 "feeCpm": {
   "currencyCode": "USD",
   "units": "0",
   "nanos": 150000000
 },
 "state": "ACTIVE",
 "accessSettings": {
   "allowlistedMediaPlanners": [
     "mediaPlanners/987654321"
   ]
 },
 "targeting": {
   "includedDeviceTypes": [
     "DEVICE_TYPE_PHONE",
     "DEVICE_TYPE_TABLET"
   ],
   "includedEnvironment": "ENVIRONMENT_SITE"
 }
}

জাভা

/*
 * 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.authorizedbuyers.marketplace.v1beta.curators.curatedPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1beta.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1beta.model.ActivateCuratedPackageRequest;
import com.google.api.services.authorizedbuyersmarketplace.v1beta.model.CuratedPackage;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1beta.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 ActivateCuratedPackage {

  /**
   * Executes the activate operation for a curated package.
   *
   * @param marketplaceClient the initialized Marketplace API client.
   * @param accountId the resource ID of the curator account.
   * @param curatedPackageId the resource ID of the curated package.
   * @throws IOException if the API returns an error.
   */
  public static void execute(
      AuthorizedBuyersMarketplace marketplaceClient, Long accountId, String curatedPackageId)
      throws IOException {
    String name = String.format("curators/%s/curatedPackages/%s", accountId, curatedPackageId);

    System.out.printf("Activating curated package with name \"%s\".%n", name);

    // Activate the specified curated package.
    CuratedPackage activatedPackage =
        marketplaceClient
            .curators()
            .curatedPackages()
            .activate(name, new ActivateCuratedPackageRequest())
            .execute();

    System.out.println("Successfully activated curated package:");
    Utils.jsonPrettyPrint(activatedPackage);
  }

  /**
   * Creates and configures the ArgumentParser for this sample.
   *
   * @return the configured ArgumentParser.
   */
  private static ArgumentParser createArgumentParser() {
    ArgumentParser parser =
        ArgumentParsers.newFor("ActivateCuratedPackage")
            .build()
            .defaultHelp(true)
            .description("Activates a specified curated package.");

    // Required arguments.
    parser
        .addArgument("-a", "--account_id")
        .help("The account ID of the curator that created the curated package.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-c", "--curated_package_id")
        .help("The resource ID of the curated package to activate.")
        .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);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace 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("curated_package_id"));
    } catch (IOException ex) {
      System.out.printf("Marketplace API returned error response:%n%s", ex);
      System.exit(1);
    }
  }
}

একটি কিউরেটেড প্যাকেজ নিষ্ক্রিয় করুন

আপনার কিউরেটেড প্যাকেজগুলোর কোনো একটি নিষ্ক্রিয় করতে, curators.curatedPackages.deactivate মেথডটি ব্যবহার করুন। যখন একটি কিউরেটেড প্যাকেজ নিষ্ক্রিয় থাকে, তখন মিডিয়া প্ল্যানাররা সেই কিউরেটেড প্যাকেজের সাবস্ক্রাইব করা থাকলেও, সেই প্যাকেজের টার্গেট করা ইনভেন্টরির জন্য রিয়েল-টাইম বিডিং বিড রিকোয়েস্টে কিউরেটেড প্যাকেজটির curatedPackageId পান না।

নিম্নলিখিত উদাহরণটি এপিআই এন্ডপয়েন্টে একটি POST অনুরোধ পাঠায় যা নির্দিষ্ট কিউরেটেড প্যাকেজটিকে নিষ্ক্রিয় করে:

বিশ্রাম

অনুরোধ

POST https://authorizedbuyersmarketplace.googleapis.com/v1beta/curators/[YOUR_ACCOUNT_ID]/curatedPackages/123456789:deactivate?alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{}

প্রতিক্রিয়া

{
 "name": "curators/[YOUR_ACCOUNT_ID]/curatedPackages/123456789",
 "displayName": "Premium Mobile Web Package",
 "description": "High-performing mobile web inventory for premium brands.",
 "createTime": "2026-06-01T16:00:00Z",
 "updateTime": "2026-06-01T16:25:00Z",
 "floorPriceCpm": {
   "currencyCode": "USD",
   "units": "2",
   "nanos": 500000000
 },
 "feeCpm": {
   "currencyCode": "USD",
   "units": "0",
   "nanos": 150000000
 },
 "state": "INACTIVE",
 "accessSettings": {
   "allowlistedMediaPlanners": [
     "mediaPlanners/987654321"
   ]
 },
 "targeting": {
   "includedDeviceTypes": [
     "DEVICE_TYPE_PHONE",
     "DEVICE_TYPE_TABLET"
   ],
   "includedEnvironment": "ENVIRONMENT_SITE"
 }
}

জাভা

/*
 * 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.authorizedbuyers.marketplace.v1beta.curators.curatedPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1beta.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1beta.model.CuratedPackage;
import com.google.api.services.authorizedbuyersmarketplace.v1beta.model.DeactivateCuratedPackageRequest;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1beta.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 DeactivateCuratedPackage {

  /**
   * Executes the deactivate operation for a curated package.
   *
   * @param marketplaceClient the initialized Marketplace API client.
   * @param accountId the resource ID of the curator account.
   * @param curatedPackageId the resource ID of the curated package.
   * @throws IOException if the API returns an error.
   */
  public static void execute(
      AuthorizedBuyersMarketplace marketplaceClient, Long accountId, String curatedPackageId)
      throws IOException {
    String name = String.format("curators/%s/curatedPackages/%s", accountId, curatedPackageId);

    System.out.printf("Deactivating curated package with name \"%s\".%n", name);

    // Deactivate the specified curated package.
    CuratedPackage deactivatedPackage =
        marketplaceClient
            .curators()
            .curatedPackages()
            .deactivate(name, new DeactivateCuratedPackageRequest())
            .execute();

    System.out.println("Successfully deactivated curated package:");
    Utils.jsonPrettyPrint(deactivatedPackage);
  }

  /**
   * Creates and configures the ArgumentParser for this sample.
   *
   * @return the configured ArgumentParser.
   */
  private static ArgumentParser createArgumentParser() {
    ArgumentParser parser =
        ArgumentParsers.newFor("DeactivateCuratedPackage")
            .build()
            .defaultHelp(true)
            .description("Deactivates a specific curated package.");

    // Required arguments.
    parser
        .addArgument("-a", "--account_id")
        .help("The account ID of the curator that created the curated package.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-c", "--curated_package_id")
        .help("The resource ID of the curated package to deactivate.")
        .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);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace 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("curated_package_id"));
    } catch (IOException ex) {
      System.out.printf("Marketplace API returned error response:%n%s", ex);
      System.exit(1);
    }
  }
}

পরবর্তী পদক্ষেপ

curatedPackages রিসোর্স ব্যবহার করে আপনি আরও কী কী ওয়ার্কফ্লো সম্পাদন করতে পারেন, সে সম্পর্কে জানতে নিম্নলিখিত বিষয়বস্তু পর্যালোচনা করুন: