Error: The Value Already Exists - Is it possible to return the resource name (of the original object)?

36 views
Skip to first unread message

F B

unread,
Mar 29, 2019, 4:14:46 AM3/29/19
to AdWords API and Google Ads API Forum
I've been wondering if there is a good way of retrieving the resource_name of an object that already exists.

Say I am creating new conversion actions and realize, ohh the value already exists. It would be nice to just get back the resource name and use that name. The way I see it I would have to query for the resource name if I encounter this particular error.

Fault: {
  "errors": [
    {
      "errorCode": {
        "conversionActionError": "DUPLICATE_NAME"
      },
      "message": "The specified conversion action name already exists.",
      "trigger": {
        "stringValue": "Call Conversion Action V2"
      },
      "location": {
        "fieldPathElements": [
          {
            "fieldName": "operations",
            "index": "0"
          },
          {
            "fieldName": "create"
          },
          {
            "fieldName": "name"
          }
        ]
      }
    }
  ]
}

Cheers

googleadsapi...@google.com

unread,
Mar 29, 2019, 5:34:40 AM3/29/19
to AdWords API and Google Ads API Forum
Hi,

Thank you for reaching out. Could you confirm if you wish to check if the conversion_action.name already exists before saving? If yes, you could check ConversionActionService and use GetConversionAction method in order to check if the name already exists before using MutateConversionActions.

Let me know if this answers your concern, feel free to write back if you have any clarification.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@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/fe9fbd71-79d9-4619-b965-c2b5c54050d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

F B

unread,
Mar 29, 2019, 6:03:29 AM3/29/19
to AdWords API and Google Ads API Forum
Hi there,

This would work if I knew the resource name of the conversion action, which at this point I don't.

As far as I understand one can only check if they already know the resource_name. The way I see it this would only come up if you want to confirm that a particular resource still exists and has not been deleted in the meantime. It does not help you to prevent creating duplicates. 

Which brings me to a new problem, for me the following query does not return any results:

    conversion_actions = """
        SELECT
             conversion_action.name,
             conversion_action.include_in_conversions_metric,
             conversion_action.type,
             conversion_action.category,
             conversion_action.resource_name
        FROM
             conversion_action
    """

although there certainly are conversion_actions present in the account.

F B

unread,
Mar 29, 2019, 6:27:26 AM3/29/19
to AdWords API and Google Ads API Forum
I just confirmed that there seems to be a bug. I did create a new conversionAction and noted down the resource_name

_ads_client = _get_ads_client()
service
= _ads_client.get_service('ConversionActionService', version='v1')
res
= service.get_conversion_action("customers/<my_client_id>/conversionActions/<conversionActionId taken from the result of the previously created one>")
print(res)

yields no results.

However, doing the same thing for a sitelink works perfectly fine.

_ads_client = _get_ads_client()
service
= _ads_client.get_service('ExtensionFeedItemService', version='v1')
res
= service.get_extension_feed_item("customers/<my_client_id>/extensionFeedItems/<SitelinkId>")
print(res)

googleadsapi...@google.com

unread,
Apr 1, 2019, 2:31:58 AM4/1/19
to AdWords API and Google Ads API Forum
Hi,

To further investigate this, could you provide us the complete JSON request and response logs when you are executing the ConversionActionService? Please reply via Reply privately to authorIf you haven't enabled logging yet, you could enable it by following this guide.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages