লাইন আইটেম সক্রিয় করুন

লাইন আইটেম অবশ্যই ড্রাফট অবস্থায় তৈরি করতে হবে। LineItem এর entityStatus ফিল্ড আপডেট করার জন্য একটি patch রিকোয়েস্ট ব্যবহার করুন। একটি লাইন আইটেম সক্রিয় না থাকলে বিজ্ঞাপন দেখাবে না।

একটি লাইন আইটেম সক্রিয় করার পদ্ধতি নিচে দেওয়া হলো:

জাভা

// Create the structure for the updated line item.
LineItem lineItem = new LineItem().setEntityStatus("ENTITY_STATUS_ACTIVE");

// Configure the patch request and set update mask to only update entity status.
LineItems.Patch request =
    service
        .advertisers()
        .lineItems()
        .patch(advertiserId, lineItemId, lineItem)
        .setUpdateMask("entityStatus");

// Update the line item.
LineItem response = request.execute();

// Display the new line item entity status.
System.out.printf(
    "LineItem %s now has entity status %s%n", response.getName(), response.getEntityStatus());

পাইথন

# Create the structure for the updated line item.
line_item_obj = {
    "entityStatus": "ENTITY_STATUS_ACTIVE",
}

# Build and execute request.
response = (
    service.advertisers()
    .lineItems()
    .patch(
        advertiserId=advertiser-id,
        lineItemId=line-item-id,
        updateMask="entityStatus",
        body=line_item_obj,
    )
    .execute()
)

# Display the new line item entity status.
print(
    f"Line Item {response['name']} now has entity status "
    f"{response['entityStatus']}."
)

পিএইচপি

// Create the structure for the updated line item.
$lineItem = new Google_Service_DisplayVideo_LineItem();
$lineItem->setEntityStatus('ENTITY_STATUS_ACTIVE');
$optParams = array('updateMask' => 'entityStatus');

// Call the API, updating the entity status for the identified line
// item.
try {
    $result = $this->service->advertisers_lineItems->patch(
        advertiser-id,
        line-item-id,
        $lineItem,
        $optParams
    );
} catch (\Exception $e) {
    $this->renderError($e);
    return;
}

// Display the new line item entity status.
printf(
    '<p>Line Item %s now has entity status %s.</p>',
    $result['name'],
    $result['entityStatus']
);