I have a problem with Python Api wrapper 'magellantoo/ctct-python-sdk' (https://github.com/magellantoo/ctct-python-sdk).
Our project gets auth token via frontend, written on PHP. Then API key, access token and some other data are passed
into Python script, which registered as RabbitMQ worker. There I instanitate API wrapper and invoke some method, i.e.:
ctct = ConstantContact(apikey, access_token)
lists = self.ctct.list_service.get_lists()
and I've got an expected result set (JSON).
But if I invoke any method with param, i.e.:
list = self.ctct.list_service.get_list_contacts(list_id)
I've got such message '596 Service Not Found' as result.
Can anyone help or giv a hint?
Solved! Go to Solution.
In the case of a 596 error, it will be an issue with the URL used to call the API is almost every case. For our V2 API, the service is determined by the part of the URL immediately following /v2/. For example, when calling /v2/lists you are calling the lists service. A 596 error indicates that the service name provided was invalid.
After reviewing the SDK, I found that there was indeed a bug where it calls /v2/list instead of /v2/lists. You can see the issue here: https://github.com/magellantoo/ctct-python-sdk/blob/master/constantcontact/listservice.py#L47
I've submitted a pull request for the author of the SDK to review. You can see the change needed to fix this here: https://github.com/magellantoo/ctct-python-sdk/pull/4/files
Hopefully this helps you to get up and running!
Thank you very much! You saved me a lot of time :)
By the way, it would be nice to add in API documentation the description of error code 596
Thank you for the feedback! In this case it's a bit complicated, as the document you linked is specific to our V1 API which does not have the same errors as our V2 API. This is a bit tricky to document for V2 as we opted to show the status codes on a per-endpoint basis rather than having a global table. In particular this code doesn't make a great deal of sense to document on every endpoint, as it only shows up when you've entered the URL incorrectly and are not calling a valid service that would contain a valid endpoint.
I'll chat with the team here and see if we can come up with a way to document this better!