diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-27 17:01:50 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-27 17:01:50 +0700 |
| commit | 241df23ed0bc2e0aefdc032900753b04399d190d (patch) | |
| tree | 1d80d9e214258474c726d5559c1bc43c17341902 /indoteknik_custom/models/wati_api.py | |
| parent | 3b2f11da025094d676b2eea0b32794852dc9f748 (diff) | |
Wati update contact attribute
Diffstat (limited to 'indoteknik_custom/models/wati_api.py')
| -rw-r--r-- | indoteknik_custom/models/wati_api.py | 8 |
1 files changed, 4 insertions, 4 deletions
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"}] }) |
