I am attempting to upload offline data using the Python suds based API  

OfflineDataUploadService (v201708)


We are getting the following error:


suds.WebFault: Server raised fault: 'Cannot construct an instance of 
com.google.ads.api.services.datax.offlinedataupload.UploadMetadata because 
it is abstract.  You are probably missing an @Uses annotation while 
invoking public abstract 
com.google.ads.api.services.datax.offlinedataupload.OfflineDataUploadReturnValue
 
com.google.ads.api.services.datax.offlinedataupload.OfflineDataUploadService.mutate(java.util.List)
 
throws com.google.ads.api.services.common.error.ApiException with params 
[[com.google.ads.api.services.datax.offlinedataupload.v201708.jaxbgen.OfflineDataUploadOperation@464070a1]].'


The Python suds code is attached. Below is the XML.


Any suggestions or examples of using the OfflineDataUploadService would be 
welcome.


- Steve W.


<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope 
xmlns:tns="https://adwords.google.com/api/adwords/rm/v201708"; 
xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201708"; 
xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201708"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
   <SOAP-ENV:Header>
      <tns:RequestHeader>
         <tns:clientCustomerId 
xmlns:tns="https://adwords.google.com/api/adwords/cm/v201708";>***-***-****</tns:clientCustomerId>
         <tns:developerToken 
xmlns:tns="https://adwords.google.com/api/adwords/cm/v201708";>*********************</tns:developerToken>
         <tns:userAgent 
xmlns:tns="https://adwords.google.com/api/adwords/cm/v201708";>Euclid 
AdAdmin (AwApi-Python, googleads/8.0.0, Python/2.7.10)</tns:userAgent>
         <tns:validateOnly 
xmlns:tns="https://adwords.google.com/api/adwords/cm/v201708";>false</tns:validateOnly>
         <tns:partialFailure 
xmlns:tns="https://adwords.google.com/api/adwords/cm/v201708";>false</tns:partialFailure>
      </tns:RequestHeader>
   </SOAP-ENV:Header>
   <ns0:Body>
      <ns2:mutate>
         <ns2:operations>
            <ns1:operator>ADD</ns1:operator>
            <ns2:operand>
               <ns2:uploadId>123</ns2:uploadId>
               <ns2:externalUploadId>456</ns2:externalUploadId>
              
 <ns2:uploadType>STORE_SALES_UPLOAD_THIRD_PARTY</ns2:uploadType>
               <ns2:uploadStatus/>
               <ns2:uploadMetadata xsi:type="ns2:ThirdPartyUploadMetadata">
                  <ns2:loyaltyRate>0.0</ns2:loyaltyRate>
                  <ns2:transactionUploadRate>0.0</ns2:transactionUploadRate>
                  
<ns2:advertiserUploadTime>01:05:00</ns2:advertiserUploadTime>
                  <ns2:validTransactionRate>0.0</ns2:validTransactionRate>
                  <ns2:partnerMatchRate>0.0</ns2:partnerMatchRate>
                  <ns2:partnerUploadRate>0.0</ns2:partnerUploadRate>
                  
<ns2:bridgeMapVersionId>bridgeId123</ns2:bridgeMapVersionId>
                  <ns2:partnerId>partnerId123</ns2:partnerId>
               </ns2:uploadMetadata>
               <ns2:offlineDataList>
                  <ns2:userIdentifiers>
                    
 <ns2:userIdentifierType>EXTERNAL_USER_ID</ns2:userIdentifierType>
                     <ns2:value>id123</ns2:value>
                  </ns2:userIdentifiers>
                  <ns2:transactionTime>2017-10-31 
17:30:00-08:00</ns2:transactionTime>
                  <ns2:transactionAmount>0</ns2:transactionAmount>
                  <ns2:conversionName></ns2:conversionName>
               </ns2:offlineDataList>
               <ns2:failureReason/>
            </ns2:operand>
         </ns2:operations>
      </ns2:mutate>
   </ns0:Body>
</SOAP-ENV:Envelope>



-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/de451605-f7b4-40aa-ac26-16730c5f45ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#
# Example from: https://developers.google.com/api-client-library/python/auth/service-accounts
#
import datetime
from googleads import adwords
from googleads import oauth2
from httplib2 import Http
from oauth2client import client
import logging
import constants

logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG) # MUST BE THIS?
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
logging.getLogger('suds.resolver').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.query').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.basic').setLevel(logging.DEBUG)
logging.getLogger('suds.binding.marshaller').setLevel(logging.DEBUG)

scopes = ['https://www.googleapis.com/auth/adwords']


# Authorization

credentials = client.OAuth2Credentials(
    None, constants.CLIENT_ID, constants.CLIENT_SECRET, constants.REFRESH_TOKEN,
    datetime.datetime(2049, 1, 1, 12), constants.GOOGLE_OAUTH2_ENDPOINT,
    constants.USER_AGENT)
logging.warning(credentials)

# Adword Client

adwords_client = adwords.AdWordsClient.LoadFromStorage(constants.GOOGLEADS_YAML)
# logging.warning(adwords_client)

adwords_client.SetClientCustomerId(constants.CLIENT_CUSTOMER_ID)
# adwords_client.SetClientCustomerId(constants.POST_VISITS_AS_ZERO_DOLLAR_TRANSACTIONS_ACCOUNT_ID)
# logging.warning(adwords_client)

# OfflineDataUpload Operations
offline_data_upload_service = adwords_client.GetService('OfflineDataUploadService', version=constants.VERSION)

# User suds to make OfflineDataUploadService calls
suds_client = offline_data_upload_service.suds_client


# create a user identifier
user_identifier = suds_client.factory.create('UserIdentifier')
user_identifier.userIdentifierType = 'EXTERNAL_USER_ID'
user_identifier.value = 'id123'

# create a store sales transaction
store_sales_transaction = suds_client.factory.create('StoreSalesTransaction')
store_sales_transaction.userIdentifiers = [user_identifier]
store_sales_transaction.transactionTime = '2017-10-31 17:30:00-08:00'
store_sales_transaction.transactionAmount = 0
store_sales_transaction.conversionName = ''


# create 3rd party upload metadata
third_party_upload_metadata = suds_client.factory.create('ThirdPartyUploadMetadata')
third_party_upload_metadata.loyaltyRate = 0.0
third_party_upload_metadata.transactionUploadRate = 0.0
third_party_upload_metadata.advertiserUploadTime = '01:05:00'
third_party_upload_metadata.validTransactionRate = '0.0'
third_party_upload_metadata.partnerMatchRate = '0.0'
third_party_upload_metadata.partnerUploadRate = '0.0'
third_party_upload_metadata.bridgeMapVersionId = 'bridgeId123'
third_party_upload_metadata.partnerId = 'partnerId123'


offline_data_upload = suds_client.factory.create('OfflineDataUpload')
offline_data_upload.uploadId = 123
offline_data_upload.externalUploadId = 456
offline_data_upload.uploadType = 'STORE_SALES_UPLOAD_THIRD_PARTY'
offline_data_upload.uploadMetadata = third_party_upload_metadata
offline_data_upload.offlineDataList = [store_sales_transaction]


operation = suds_client.factory.create('OfflineDataUploadOperation')
operation.operator = 'ADD'
operation.operand = offline_data_upload

# The service object returned from the client.GetService() call accepts suds
# objects and will set the SOAP and HTTP headers for you.
response = offline_data_upload_service.mutate([operation])
logging.warning(response)
logging.warning(suds_client.last_sent())
logging.warning(suds_client.last_received())

Reply via email to