From 241df23ed0bc2e0aefdc032900753b04399d190d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 27 Feb 2023 17:01:50 +0700 Subject: Wati update contact attribute --- indoteknik_custom/models/wati_api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models/wati_api.py') diff --git a/indoteknik_custom/models/wati_api.py b/indoteknik_custom/models/wati_api.py index 156483f6..476f542d 100644 --- a/indoteknik_custom/models/wati_api.py +++ b/indoteknik_custom/models/wati_api.py @@ -19,7 +19,7 @@ class WatiApi(models.Model): def http_get(self, endpoint: str, url_params: dict): try: url_params = urllib.parse.urlencode(url_params) - url = "%s/%s?%s" % (self.api_url(), endpoint, url_params) + url = self.api_url() + endpoint + "?%s" % url_params headers = self.api_header() response = requests.get(url, headers=headers) return response.json() @@ -28,7 +28,7 @@ class WatiApi(models.Model): def http_post(self, endpoint: str, data: dict): try: - url = "%s/%s" % (self.api_url(), endpoint) + url = self.api_url() + endpoint headers = self.api_header() response = requests.post(url, headers=headers, json=data) return response.json() @@ -38,13 +38,13 @@ class WatiApi(models.Model): def _test(self, method): res = False if method == 'GET': - res = self.http_get('v1/getContacts', { + res = self.http_get('/api/v1/getContacts', { "name": 'Darren', "pageSize": 10, "pageNumber": 1 }) elif method == 'POST': - res = self.http_post('v1/updateContactAttributes/6281290696017', { + res = self.http_post('/api/v1/updateContactAttributes/6281290696017', { "customParams": [{"name": "name", "value": "Darren"}] }) -- cgit v1.2.3