Discard

Criteo Marketing Solutions API

Questions

Ask A Question
0

API Response coming in a different language

Hi, this is regarding Criteo API Response not coming in the English language, even after passing the right language headers. Just wanted to confirm if this is an issue from criteo's end and if there is any way to localise the API response? Request Headers Content-Type:"application/json; charset=UTF-8", Accept-Charset:"utf-8, iso-8859-1;q=0.7", Accept-Language:"en-US,en;q=0.5", user-agent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36"] Criteo Response Response received from Service:<200,笀਀  ∀洀攀琀愀搀愀琀愀∀㨀 笀਀    ∀琀漀琀愀氀䤀琀攀洀猀䄀挀爀漀猀猀䄀氀氀倀愀最攀猀∀㨀 ㈀Ⰰ਀    ∀挀甀爀爀攀渀琀倀愀最攀匀椀稀攀∀㨀 ㈀Ⰰ਀    ∀挀甀爀爀攀渀琀倀愀最攀䤀渀搀攀砀∀㨀  Ⰰ਀    ∀琀漀琀愀氀倀愀最攀猀∀㨀 ㄀਀  紀Ⰰ਀  ∀搀愀琀愀∀㨀 嬀਀    笀਀      ∀椀搀∀㨀 ∀㜀㜀㌀㌀㐀㘀㜀 ∀Ⰰ਀      ∀琀礀瀀攀∀㨀 ∀刀攀琀愀椀氀䴀攀搀椀愀倀爀漀洀漀琀攀搀倀爀漀搀甀挀琀∀Ⰰ਀      ∀愀琀琀爀椀戀甀琀攀猀∀㨀 笀਀        ∀戀椀搀伀瘀攀爀爀椀搀攀∀㨀  ⸀㔀       ਀      紀਀    紀Ⰰ਀    笀਀      ∀椀搀∀㨀 ∀㜀㜀㌀㌀㐀㘀㘀㜀∀Ⰰ਀      ∀琀礀瀀攀∀㨀 ∀刀攀琀愀椀氀䴀攀搀椀愀倀爀漀洀漀琀攀搀倀爀漀搀甀挀琀∀Ⰰ਀      ∀愀琀琀爀椀戀甀琀攀猀∀㨀 笀਀        ∀戀椀搀伀瘀攀爀爀椀搀攀∀㨀  ⸀㔀       ਀      紀਀    紀਀  崀਀紀,[date:"Mon, 02 Aug 2021 05:49:14 GMT", content-type:"application/json; charset=utf-16", server:"Kestrel", content-length:"874", access-control-expose-headers:"X-JWT-Token", link:"<https://api.criteo.com/preview/retail-media/line-items/193293755391266816/products?pageIndex=0&pageSize=2>; rel=first,<https://api.criteo.com/preview/retail-media/line-items/193293755391266816/products?pageIndex=0&pageSize=2>; rel=last", x-jwt-token:"Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ilg1YUQ1YmpiOWF3cUM1Z3ZXNTJidkRoRE1BTFJIOVRCZHh6SjloQnlvNU0iLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE2Mjc5Njk3NTMsImlhdCI6MTYyNzg4MzM1MywiaXNzIjoiY3JpdGVvLWNlcmJlcnVzIiwiY3R4OmFwcGxpY2F0aW9uOmlkIjoiMTczNiIsImF1ZCI6ImNyaXRlby1hcGlnYXRld2F5IiwiY3R4OnVzZXI6ZW1haWwiOiJhcGktcHJvZ3JhbS11c2VyQDRkOTBjZWIzMDdkNDRlNzM4ZDBmYmY0ODI1Mzk1ZjE2LmNvbSIsImN0eDphcHBsaWNhdGlvbjpuYW1lIjoiQ29tbWVyY2VJUSIsImFkZDptYXBpOnVuYW1lIjoiYXBpLXByb2dyYW0tdXNlci00ZDkwY2ViMzA3ZDQ0ZTczOGQwZmJmNDgyNTM5NWYxNiIsImN0eDp1c2VyOnVpZCI6InVtczphcGktcHJvZ3JhbS11c2VyLTRkOTBjZWIzMDdkNDRlNzM4ZDBmYmY0ODI1Mzk1ZjE2IiwiY3R4OnVzZXI6dW1zSWQiOiIzNzc0MjIiLCJjdHg6dXNlcjpkaXNwbGF5TmFtZSI6ImFwaS1wcm9ncmFtLXVzZXItNGQ5MGNlYjMwN2Q0NGU3MzhkMGZiZjQ4MjUzOTVmMTYiLCJjdHg6b3JnYW5pemF0aW9uOm5hbWUiOiJDb21tZXJjZUlRIiwiY2xpZW50X2lkIjoiZWYyOWNmZDYyMWE4NDY5MGFkOTY1ZmR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it:"100", x-ratelimit-remaining:"99"]>

Posted by Ishank S 2 months ago

0

python sdk Unauthorized error

We have opened developer account for new maps versions and created and app - we try to do everything as told. The problem is I can get with my credentials from app on: https://developers.criteo.com/marketing-solutions/reference/oauth but when I try same credentials with python sdk i get Unauthorized error. The application build with menager account. This is my code: ############### from criteo_marketing_transition import Configuration import criteo_marketing_transition as cm from datetime import date, timedelta, datetime CRITEO_API_CLIENT_ID: " " CRITEO_API_CLIENT_SECRET:" " GRANT_TYPE: "client_credentials" configuration = Configuration(username=CRITEO_API_CLIENT_ID, password=CRITEO_API_CLIENT_SECRET) client = criteo_marketing_transition.ApiClient(configuration) oauth = criteo_marketing_transition.OAuthApi(client) analytics_api = cm.AnalyticsApi(client) stats_query_message = cm.StatisticsReportQueryMessage(advertiser_ids=, dimensions=["day"], metrics=["AdvertiserCost"], start_date=date.today(), end_date=date.today(), currency="TRY", format="json") [response_content, http_code, response_headers] = analytics_api.get_adset_report_with_http_info(statistics_report_query_message=stats_query_message) ############# This is the Error message: ############# --------------------------------------------------------------------------- ApiException Traceback (most recent call last) <ipython-input-78-2bdaca9b7a37> in <module> 24 # Use the method with 'with_http_info' if you want to retrieve the filename 25 # Otherwise, you can directly call the get_adset_report method ---> 26 [response_content, http_code, response_headers] = analytics_api.get_adset_report_with_http_info(statistics_report_query_message=stats_query_message) /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/api/analytics_api.py in get_adset_report_with_http_info(self, **kwargs) 129 auth_settings = ['Authorization'] # noqa: E501 130 --> 131 return self.api_client.call_api( 132 '/2021-04/statistics/report', 'POST', 133 path_params, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/api_client.py in call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, async_req, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host) 334 """ 335 if not async_req: --> 336 return self.__call_api(resource_path, method, 337 path_params, query_params, header_params, 338 body, post_params, files, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/api_client.py in __call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host) 166 167 # perform request and return response --> 168 response_data = self.request( 169 method, url, query_params=query_params, headers=header_params, 170 post_params=post_params, body=body, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/api_client.py in request(self, method, url, query_params, headers, post_params, body, _preload_content, _request_timeout) 378 body=body) 379 elif method == "POST": --> 380 return self.rest_client.POST(url, 381 query_params=query_params, 382 headers=headers, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in POST(self, url, headers, query_params, post_params, body, _preload_content, _request_timeout) 279 def POST(self, url, headers=None, query_params=None, post_params=None, 280 body=None, _preload_content=True, _request_timeout=None): --> 281 return self.request("POST", url, 282 headers=headers, 283 query_params=query_params, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in request(self, method, url, query_params, headers, body, post_params, no_auth, _preload_content, _request_timeout) 148 149 if not no_auth: --> 150 self.refresh_token(headers) 151 headers['Authorization'] = 'Bearer ' + self.token.access_token 152 /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in refresh_token(self, headers) 313 314 if not missing_credentials and missing_or_expired_token: --> 315 self.token = self.call_auth_endpoint(headers) 316 return True 317 return False /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in call_auth_endpoint(self, headers) 338 return Token(data['access_token'], data['expires_in']) 339 except ApiException as e: --> 340 raise self._enrich_exception_message(e, oauth_url) 341 342 @staticmethod /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in call_auth_endpoint(self, headers) 327 try: 328 params = [] --> 329 response = self.request("POST", oauth_url, 330 headers=new_headers, 331 query_params=params, /usr/local/lib/python3.9/site-packages/criteo_marketing_transition/rest.py in request(self, method, url, query_params, headers, body, post_params, no_auth, _preload_content, _request_timeout) 238 239 if not 200 <= r.status <= 299: --> 240 raise ApiException(http_resp=r) 241 242 return r ApiException: (401) Reason: Unauthorized HTTP response headers: HTTPHeaderDict({'date': 'Thu, 08 Jul 2021 07:07:55 GMT', 'content-type': 'application/json; charset=utf-8', 'server': 'Kestrel', 'content-length': '213', 'vary': 'Accept-Encoding'}) HTTP response body: {'error': 'invalid_client', 'error_description': "The client authentication failed, the provided client_id doesn't exist or the client_secret is invalid", 'error_uri': 'https://tools.ietf.org/html/rfc6749#section-5.2', 'token_error': "Cannot refresh token by calling 'https://api.criteo.com/oauth2/token'"} ###############

Posted by umar igan 3 months ago

3

Duplicate categoryId=0 records in adset category report

Hello. I have a question about adset category report. The reports we created sometimes has two reocrds under the same dimesion with categoryId=0, with different metrics. The dimesions are as follows: - AdvertiserId, Advertiser, Day, AdsetId, Adset, CategoryId, Category, Device In my uderstanding, the report with these dimensions are supposed to have a unique record under the same dimesions. For example, ----------------------------------------------------------- AdvertiserId, Advertiser, Day, AdsetId, Adset, CategoryId, Category, Device, Clicks, 11111, adv1, 2021-06-10, Adset1, 1111, category1, 11111, Smartphone, 100 11111, adv1, 2021-06-10, Adset1, 1111, category2, 11112, Smartphone, 120 ----------------------------------------------------------- However, sometimes there are two records under the same dimension with categoryId=0 as follows: ----------------------------------------------------------- AdvertiserId, Advertiser, Day, AdsetId, Adset, CategoryId, Category, Device, Clicks, 11111, adv1, 2021-06-10, Adset1, 1111, , 0, Smartphone, 100 11111, adv1, 2021-06-10, Adset1, 1111, , 0, Smartphone, 10 ----------------------------------------------------------- I really appreciate if you cloud tell us how to interpret those two records? Metrics are as follows: Metrics: Clicks,Displays,AdvertiserCost,SalesAllPc30d,SalesPc30d,SalesPv24h,SalesAllPv24h,SalesAllPc30dPv24h,PostInstallSales,AppInstalls,SalesOfflinePc30d,OmnichannelSalesAllPc30d,RoasPc30d,RoasAllPc30d,RoasOfflinePc30d,OmnichannelRoasAllPc30d,RevenueGeneratedAllPc30d,RevenueGeneratedAllPv24h,RevenueGeneratedAllPc30dPv24h,RevenueGeneratedOfflinePc30d,OmnichannelRevenueAllPc30d,AverageCartAllPc30d,ConversionRateAllPc30d,ConversionRateAllPv24h,ClickThroughRate,Cpc,ECpm,ECosAllPc30d,ECosAllPv24h,ECosAllPc30dPv24h,CostPerOrderAllPc30d,CostPerOrderAllPv24h,CostPerOrderAllPc30dPv24h,AdvertiserAllValue,CostOfAdvertiserValueAll,ExposedUsers,OverallCompetitionWin,Audience,Reach,ViewableDisplays,NonViewableDisplays,UntrackableDisplays,BounceRate,PotentialDisplays,QualifiedVisits,Visits,RevenueGeneratedPc30d

Posted by Yasushi Otsuka 4 months ago