Search code examples
javafacebook-marketing-api

Get custom audience by name using Facebook Marketing API


Is it possible to get/fetch a custom audience by it's name?

When I use adAccount.getCustomAudiences() it returns only id fields of Custom Audiences without any name or description data.

I want to check if an audience exists or not in order to add more users.


Solution

  • I finally figured it out.

    adAccount.getCustomAudiences().requestField("name").execute();
    

    This returns all audiences with name fields.