Skip to content

list_entities: search parameter not mapped to 'q' query param #10

@vdavez

Description

@vdavez

Bug

TangoClient.list_entities() accepts a search keyword argument, and the docstring says it "maps to 'q' parameter." However, the implementation sends search as the literal query parameter name instead of q:

# In tango/client.py, list_entities():

# Map 'search' parameter to 'q' (query parameter)
if search:
    params["search"] = search  # Bug: should be params["q"] = search

This causes the Tango API to return 400 Bad Request since it doesn't recognize search as a valid query parameter on /api/entities/.

Steps to reproduce

from tango import TangoClient

client = TangoClient()
# This sends GET /api/entities/?search=booz+allen+hamilton → 400 Bad Request
response = client.list_entities(search="booz allen hamilton")

Expected behavior

The SDK should send q=booz+allen+hamilton in the query string, matching the API's expected parameter name and the docstring's documented behavior.

Workaround

Pass q directly as a filter kwarg:

# This works — sends GET /api/entities/?q=booz+allen+hamilton → 200 OK
response = client.list_entities(q="booz allen hamilton")

Fix

In list_entities, change:

params["search"] = search

to:

params["q"] = search

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