I tried to make a MediaFile using MediaFileService but failing repeatedly.

    media_file_service = client.get_service('MediaFileService', version='v1')

    # create media file
    media_file_operation = client.get_type('MediaFileOperation', version='v1')
    media_file = media_file_operation.create
    media_file.name.value = 'Bugs bunny'
    media_file.source_url.value = 'http://cdn.zzz.com'
    media_file.type = client.get_type('MediaTypeEnum', 
version='v1').DYNAMIC_IMAGE
    media_file.mime_type = client.get_type('MimeTypeEnum', 
version='v1').IMAGE_GIF
    with open('candy_1.gif', 'rb') as fp:
        data = fp.read()
        media_file.image.data.value = bytes(data)
    try:
        media_file_response = media_file_service.mutate_media_files(
            customer_id, [media_file_operation])
    except GoogleAdsException as ex:
        print('Request with ID "%s" failed with status "%s" and includes the '
              'following errors:' % (ex.request_id, ex.error.code().name))
        for error in ex.failure.errors:
            print('\tError with message "%s".' % error.message)
            if error.location:
                for field_path_element in error.location.field_path_elements:
                    print('\t\tOn field: %s' % field_path_element.field_name)
        sys.exit(1)

Above is the code that I implemented. I did this as mentioned in the 
documentation. But not sure why this error has occurred.

Request with ID "masked" failed with status "INVALID_ARGUMENT" and includes the 
following errors:
Error with message "A required field was not specified or is an empty string.".
                On field: operations

Above is the error response I got.

Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c817b2de-29ce-4ef6-be65-a2cca2912739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Error o... Venkat
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Venkat
        • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
    • Re... Venkat
      • ... revarasi Sofa
    • Re... Venkat
    • Re... Venkat
    • RE... Google Ads API Forum Advisor Prod

Reply via email to