Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(warehouse_sources): support LinkedIn Ads API version 202607 (#74147)

Tom Owers33d697b086a2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py
index aa4edb80904a..c5b2f9797fe0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py
@@ -52,12 +52,14 @@ from .linkedin_ads import (
# LinkedIn's Marketing API uses monthly date-based versioning (YYYYMM) sent as a request header.
LINKEDIN_ADS_VERSION_202606 = "202606"
+LINKEDIN_ADS_VERSION_202607 = "202607"
# Opaque source version label -> LinkedIn API version header. The legacy `v1` pin keeps sending the
# header it always has (`API_VERSION`), so existing syncs are byte-for-byte unchanged.
_API_HEADER_BY_VERSION = {
UNVERSIONED_API_VERSION: API_VERSION,
LINKEDIN_ADS_VERSION_202606: LINKEDIN_ADS_VERSION_202606,
+ LINKEDIN_ADS_VERSION_202607: LINKEDIN_ADS_VERSION_202607,
}
@@ -65,8 +67,8 @@ _API_HEADER_BY_VERSION = {
class LinkedInAdsSource(ResumableSource[LinkedinAdsSourceConfig, LinkedInAdsResumeConfig], OAuthMixin):
api_docs_url = "https://learn.microsoft.com/en-us/linkedin/marketing/versioning"
- supported_versions = (UNVERSIONED_API_VERSION, LINKEDIN_ADS_VERSION_202606)
- default_version = LINKEDIN_ADS_VERSION_202606
+ supported_versions = (UNVERSIONED_API_VERSION, LINKEDIN_ADS_VERSION_202606, LINKEDIN_ADS_VERSION_202607)
+ default_version = LINKEDIN_ADS_VERSION_202607
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py
index 0deacc1f1cca..1e22f31aac4c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py
@@ -45,7 +45,7 @@ class TestLinkedinAdsClient:
assert result == [{"id": "123", "name": "Test Account"}]
mock_client_instance.finder.assert_called_once()
- @pytest.mark.parametrize("api_version", ["202508", "202606"])
+ @pytest.mark.parametrize("api_version", ["202508", "202606", "202607"])
@mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.linkedin_ads.client.RestliClient")
def test_request_sends_configured_api_version(self, mock_restli_client, api_version):
"""The configured version must reach the Restli `version_string`, else every request hits
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py
index b13a977f942d..875a6bb44554 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py
@@ -9,6 +9,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_
from products.warehouse_sources.backend.temporal.data_imports.sources.linkedin_ads.client import LinkedinAdsClient
from products.warehouse_sources.backend.temporal.data_imports.sources.linkedin_ads.source import (
LINKEDIN_ADS_VERSION_202606,
+ LINKEDIN_ADS_VERSION_202607,
LinkedInAdsSource,
)
@@ -75,9 +76,9 @@ class TestLinkedInAdsSource:
retryable_errors = self.source.get_retryable_errors()
assert not any(pattern in other_error for pattern in retryable_errors)
- def test_defaults_new_sources_to_202606(self):
- assert self.source.default_version == LINKEDIN_ADS_VERSION_202606
- assert set(self.source.supported_versions) == {"v1", LINKEDIN_ADS_VERSION_202606}
+ def test_defaults_new_sources_to_202607(self):
+ assert self.source.default_version == LINKEDIN_ADS_VERSION_202607
+ assert set(self.source.supported_versions) == {"v1", LINKEDIN_ADS_VERSION_202606, LINKEDIN_ADS_VERSION_202607}
@pytest.mark.parametrize(
"pinned_version,expected_header",
@@ -86,8 +87,9 @@ class TestLinkedInAdsSource:
# sent (202508), so their syncs stay byte-for-byte unchanged after the default flip.
("v1", "202508"),
(LINKEDIN_ADS_VERSION_202606, "202606"),
+ (LINKEDIN_ADS_VERSION_202607, "202607"),
# No pin resolves to the new default.
- (None, "202606"),
+ (None, "202607"),
# An undeclared pin is honored verbatim and passed straight through for LinkedIn to validate.
("209901", "209901"),
],
@@ -116,7 +118,7 @@ class TestLinkedInAdsSource:
self.source.get_oauth_accounts(integration_id=456, team_id=self.team_id)
- assert mock_client_for_integration.call_args.kwargs["api_version"] == "202606"
+ assert mock_client_for_integration.call_args.kwargs["api_version"] == "202607"
def test_validate_credentials_missing_account_id(self):
"""Test credential validation with missing account ID."""