Skip to content

Commit

Permalink
v3.2 is now utilized for SB targets and keywords
Browse files Browse the repository at this point in the history
By default, v3.2 is now utilized for SB targets and keywords. targets and keywords associated with BrandVideo ad groups would avaliable in the response. The format remains unchanged from the previous version.
  • Loading branch information
drewxa authored Dec 6, 2023
2 parents 439d5df + 2c92095 commit 6ad6880
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 4 additions & 2 deletions ad_api/api/sb/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Keywords(Client):
"""

@sp_endpoint('/sb/keywords', method='GET')
def list_keywords(self, **kwargs) -> ApiResponse:
def list_keywords(self, version: float = 3.2, **kwargs) -> ApiResponse:
r"""
Gets an array of keywords, filtered by optional criteria.
Expand All @@ -27,7 +27,9 @@ def list_keywords(self, **kwargs) -> ApiResponse:
| ApiResponse
"""
return self._request(kwargs.pop('path'), params=kwargs)
json_version = 'application/vnd.sbkeyword.v' + str(version) + "+json"
headers = {'Accept': json_version}
return self._request(kwargs.pop('path'), params=kwargs, headers=headers)

@sp_endpoint('/sb/keywords', method='PUT')
def edit_keywords(self, **kwargs) -> ApiResponse:
Expand Down
11 changes: 4 additions & 7 deletions ad_api/api/sb/product_targeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Targets(Client):
"""

@sp_endpoint('/sb/targets/list', method='POST')
def list_products_targets(self, **kwargs) -> ApiResponse:
def list_products_targets(self, version: float = 3.2, **kwargs) -> ApiResponse:
r"""
Gets a list of product targets associated with the client identifier passed in the authorization header, filtered by specified criteria.
Expand All @@ -29,12 +29,9 @@ def list_products_targets(self, **kwargs) -> ApiResponse:
ApiResponse
"""
# contentType = 'application/vnd.sblisttargetsrequest.v3.0+json'
# headers = {'Content-Type': contentType}
# return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers)

# hotfix: up until now (2022-04-29) it just seems to consume application/json content
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)
json_version = 'application/vnd.sblisttargetsresponse.v' + str(version) + "+json"
headers = {'Accept': json_version}
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers)

@sp_endpoint('/sb/targets', method='PUT')
def edit_products_targets(self, **kwargs) -> ApiResponse:
Expand Down

0 comments on commit 6ad6880

Please sign in to comment.