Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need example on how to link a Merchant Center Account with Ads Account for API v15 #492

Open
diegosaul402 opened this issue Apr 30, 2024 · 1 comment
Labels
question Further information is requested

Comments

@diegosaul402
Copy link

What is your question?
Do you have an example for accepting the link invitation for a Merchant Center Account with an Ads account using API v15 and above?

Hello, I'm working on migrating this feature from API v14 to API v15 but only version 14 has a ruby example. Could you provide a guide on how to achieve this on v15 and above? Maybe add it to the examples folder.
Thank you!

@diegosaul402 diegosaul402 added the question Further information is requested label Apr 30, 2024
@diegosaul402
Copy link
Author

I managed to get the first part right, accepting an invitation, here is the snippet if useful for someone else

      query = <<~QUERY
        SELECT product_link_invitation.merchant_center.merchant_center_id,
               product_link_invitation.type
          FROM product_link_invitation
         WHERE product_link_invitation.status = 'APPROVED'
           AND product_link_invitation.type = 'MERCHANT_CENTER'
      QUERY

      result = client.service.google_ads.search(customer_id: customer_id, page_size: 10, query: query)

  client.service
        .product_link_invitation
        .update_product_link_invitation(customer_id: customer_id,
                                        product_link_invitation_status: :ACCEPTED,
                                        resource_name: result.product_link_invitation.resource_name)

But I'm still having issues with the direct linking without invitation
This is what I have so fart

      invitation = client.resource.product_link{ |pl| pl.type = :MERCHANT_CENTER }

      client.service.product_link.create_product_link(customer_id: current_channel.ads_id, product_link: invitation)

Documentation says that product_link accepts a merchant_center_id but I get this error trying to set it. Effectively, I can only set type and resource_name for ProductLink, so what I'm doing wrong?

`method_missing': undefined method `merchant_center_id=' for <Google::Ads::GoogleAds::V16::Resources::ProductLink: resource_name: "", type: :MERCHANT_CENTER>:Google::Ads::GoogleAds::V16::Resources::ProductLink (NoMethodError)

@mcloonan sorry to tag you but I really appreciate your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant