linkedin-developers / linkedin-api-python-client

Official Python client library for LinkedIn APIs
Other
175 stars 35 forks source link

Only textAds available #48

Open AndriiMaksiuta opened 1 year ago

AndriiMaksiuta commented 1 year ago

Hi! I have been testing LinkedIn advertisement API, created several campaign groups, campaigns and ads of all kinds of Ads. However, client only returns textAds campaigns and their ads (creatives) respectively. However, all campaign groups are present in response, even those that did not contain any textAds.

How can I retrieve other ads (creatives: video, image, message, document, carousel, etc.)?

Here is how I retrieving campaigns by campaign group id:

       search = (
            {
                "campaignGroup": {
                    "values": [
                        f"urn:li:sponsoredCampaignGroup:{campaign_group_id}"
                        for campaign_group_id in campaign_group_ids
                    ]
                },
                "id": {"values": ids},
            }
            if ids
            else {
                "campaignGroup": {
                    "values": [
                        f"urn:li:sponsoredCampaignGroup:{campaign_group_id}"
                        for campaign_group_id in campaign_group_ids
                    ]
                },
            }
        )

        response = self.api_client.finder(
            resource_path=f"/adAccounts/{account_id}/adCampaigns",
            finder_name="search",
            access_token=access_token,
            version_string=self.api_version,
            query_params={
                "search": search,
            },
        )