Skip to content

Add missing 'Tag Search' endpoint #237

@leon-matthews

Description

@leon-matthews

Apologies if I've missed something obvious, but the end point to list all of the tags belonging to an audience/list, as documented here in the Mailchimp API docs, seems to be missing.

It's an easy one. The list_id is required. There is one optional query parameter name which is used as a prefix search. I've written an API class which works for my application, and it seems to work... :-)

class SearchTags(mailchimp3.baseapi.BaseApi):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.endpoint = 'lists'
        self.list_id = None

    def all(self, list_id, get_all=False, **queryparams):
        self.list_id = list_id
        url = self._build_path(list_id, 'tag-search')
        if get_all:
            return self._iterate(url=url, **queryparams)
        else:
            return self._mc_client._get(url=url, **queryparams)

If you'd like, I could try and match your documentation style and create a pull-request instead of this issue. I've never done so before, but it is probably about time that I learnt how! Please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions