diff options
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"}] }) |
