Search code examples
pythonapigoogle-apigoogle-admin-sdkdouble-click-advertising

DoubleClick Bid Manager API not updating the line items


I am downloading line items from DBM, modifying them and uploading them again to DBM. Once uploaded, if I download and view them again, I am not able to see the modifications. There is no error in the code and the API also is not returning any errorStatus.

Code to upload line items:

service = build('doubleclickbidmanager', config.Version, http=credentials.authorize(httplib2.Http()))
request = service.lineitems().uploadlineitems(body=BODY)
response = request.execute()

if 'uploadStatus' in response and 'errors' in response['uploadStatus']:
    for error in response['uploadStatus']['errors']:
    logging.error(error)

Code to download line items:

service = build('doubleclickbidmanager', config.Version, http=credentials.authorize(httplib2.Http()))
request = service.lineitems().downloadlineitems(body=body)

print "Downloading Line Items.."
logging.info("function: Downloading Line Items..")

# Execute request and save response contents.
with open(file_path, 'wb') as handler:
    # Call the API, getting the (optionally filtered) list of line items.
    # Then write the contents of the response to a CSV file.
    lidata = request.execute()['lineItems'].encode('utf-8')
    logging.info("function:request.execute succeeded.")
    handler.write(lidata)
    print 'Download Completed.'

Is this the proper way to check whether the line item is modified, or am I doing something wrong? Is there any other way to check it?


Solution

  • Please note that api will update the line item in following cases:

    -Based on any flag,if the flag is set for the row,it will update

    -Not all the rows will get update

    Refer this link:https://developers.google.com/bid-manager/guides/entity-write/format- For those Columns, whose writeable value is yes can only be updated