Hi Nadine!
Thanks for the answer! 

But my question was about a bit different thing, how can I add custom 
question through API? I didn't find question related to Would you like to 
receive news from our company? and Agree with terms and conditions? in 
predefined questions list from Google.
So I wanted to create new custom question (it should be possible through 
API 
https://developers.google.com/google-ads/api/rest/reference/rest/v11/Asset?hl=en#LeadFormCustomQuestionField
 
):
params = {
"operations": [{
"create": {
"name": "My Lead Form #12345",
"type": "LEAD_FORM",
"final_urls": ["https://xxxxxxx.com";],
"leadFormAsset": {
"businessName": "Cats LTD",
"callToActionType": "LEARN_MORE",
"callToActionDescription": "Learn more",
"headline": "New Test Lead Form2",
"description": "New Test Lead Form description",
"privacyPolicyUrl": "https://XXX.com/en/privacy-policy/";,
"fields": [
{
"inputType": "EMAIL"
},
{
"inputType": "FIRST_NAME"
},
{
"inputType": "LAST_NAME"
},
{
"inputType": "PHONE_NUMBER"
},
{
"inputType": "COUNTRY"
},
],
"customQuestionFields": [
{
"customQuestionText": "Would you like to receive news from our company?",
"singleChoiceAnswers": {"answers": ["yes", "no"]}
},
{
"customQuestionText": "Do you agree with Terms and Conditions?",
"singleChoiceAnswers": {"answers": ["yes", "no"]}
}
],
"postSubmitCallToActionType": "VISIT_SITE",
"desiredIntent": "LOW_INTENT",
"postSubmitHeadline": "Thank you!",
"postSubmitDescription": "Thanks for filling Lead Form",

}

}
}],
}
url is https://googleads.googleapis.com/v11/customers/XXXXXX/assets:mutate

And I get response that custom question string is incorrect:
 {
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": 
"type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
                "errors": [
                    {
                        "errorCode": {
                            "fieldError": "INVALID_VALUE"
                        },
                        "message": "The field's value is invalid.",
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                },
                                {
                                    "fieldName": "create"
                                },
                                {
                                    "fieldName": "lead_form_asset"
                                },
                                {
                                    "fieldName": "custom_question_fields",
                                    "index": 0
                                },
                                {
                                    "fieldName": "custom_question_text"
                                }
                            ]
                        }
                    },
                    {
                        "errorCode": {
                            "fieldError": "INVALID_VALUE"
                        },
                        "message": "The field's value is invalid.",
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                },
                                {
                                    "fieldName": "create"
                                },
                                {
                                    "fieldName": "lead_form_asset"
                                },
                                {
                                    "fieldName": "custom_question_fields",
                                    "index": 1
                                },
                                {
                                    "fieldName": "custom_question_text"
                                }
                            ]
                        }
                    }
                ],
                "requestId": "*286AZG9PkOP0sdKWh1S_TA*"
            }
        ]
    }
}

Google team said in above responses that my request is formed correctly, 
and its possible to add new custom questions, that are not in the 
predefined questions list.

2. Second issue: I can update Lead Form fileds like name, descriptions, But 
I can't update 'fields' (questions) - I can't add or delete question:
params = {
"operations": [{
"updateMask": 
"name,leadFormAsset.businessName,leadFormAsset.headline,fields",
"update": {
"resourceName": "customers/XXXXX/assets/XXXX",
"name": "My Lead Form #123456",
"type": "LEAD_FORM",
"final_urls": ["https://xxxx.com";],
"leadFormAsset": {
"businessName": "Cats LTD New",
"callToActionType": "LEARN_MORE",
"callToActionDescription": "Learn more",
"headline": "New Test Lead Form23",
"description": "New Test Lead Form description",
"privacyPolicyUrl": "https://xxxx.com/en/privacy-policy/";,
"fields": [
{
"inputType": "EMAIL"
},
{
"inputType": "FIRST_NAME"
},
{
"inputType": "LAST_NAME"
},
{
"inputType": "PHONE_NUMBER"
},
{
"inputType": "COUNTRY"
},
{
"inputType": "CITY"
},
"postSubmitCallToActionType": "VISIT_SITE",
"desiredIntent": "LOW_INTENT",
"postSubmitHeadline": "Thank you!",
"postSubmitDescription": "Thanks for filling Lead Form",

}

}
}],
}

I wanted to add {
"inputType": "CITY"
},   to lead form fields, but I receive error:

 {
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": 
"type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
                "errors": [
                    {
                        "errorCode": {
                            "fieldMaskError": "FIELD_NOT_FOUND"
                        },
                        "message": "The field mask contained an invalid 
field: 'fields'.",
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                }
                            ]
                        }
                    }
                ],
                "requestId": "*Crb5x0gGv5ZZs1C4Xzlxaw*"
            }
        ]
    }
}

What is the way to update (add/remove) lead form fields? I need API request 
example, please?
I send it to 
https://googleads.googleapis.com/v11/customers/XXXXXX/assets:mutate

Thanks in advance!
Anna.
On Monday, September 12, 2022 at 8:56:53 PM UTC+3 adsapi wrote:

> Hello Anna,
>
> I do have an answer. It turns out that there is a pre-defined list of 
> approved custom questions. Strangely, the sample one is not one of them. 
> I've asked the folks who work on the code to fix the documentation on that.
>
> In the meantime, if you need a list of questions, I've found a way to get 
> the pre-defined list. You can go to the Google Ads UI to get it. 
>    
>    - Click on a campaign that is set up for lead forms.  
>    - Under 'Ads and Extensions', click 'Extensions'. 
>    - Then, click the '+' to create a new extension. 
>    - On the page, you can either create an extension using an existing 
>    extension or a new extension. Click 'Create new'. 
>    - Scroll down until you see a button that says '+ Question'. Click on 
>    that. 
>    - You can then start typing in the search box words that you would 
>    like to use and all approved questions will come up. 
>    - Heres's an example where I typed 'own a vehicle', and 'Do you own a 
>    vehicle?' came up as an approved question. 
>
>
> [image: Image_2022-09-12_13-49-51.png]
>
> It appears it may be possible to propose new questions through the UI as 
> well. There is an API feature request of searching for these kinds of 
> questions. I don't know the plans as to when it will be available, but in 
> the meantime, this is a workaround to allow you to search for questions 
> that you can then use in the API.
>
>
> Best,
> [image: Google Logo] 
> Nadine Wang 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2dvTj4:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7ea2cf01-f855-4314-9f4f-1495423b969bn%40googlegroups.com.
  • RE... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
    • ... Anna Lysak
      • ... Anna Lysak
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
          • ... Anna Lysak
            • ... Anna Lysak
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
              • ... Anna Lysak
              • ... Anna Lysak
              • ... Anna Lysak
              • ... Anna Lysak
              • ... Anna Lysak
              • ... Anna Lysak
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to