Skip to content

Querying

Every .get() method in the SDK accepts an optional filter dict. The filter follows the LoopBack query syntax used by the MagicFeedback API.

filter = {
"where": {…},
"limit": 50,
"skip": 0,
"order": "createdAt DESC",
"fields": {…},
"include": [],
}

All keys are optional. Pass only the ones you need.

contacts = client.contacts.get({
"where": {
"companyId": "YOUR_COMPANY_ID",
}
})

Multiple conditions in where are combined as AND:

feedbacks = client.feedbacks.get({
"where": {
"companyId": "YOUR_COMPANY_ID",
"type": "APP",
}
})

Use limit and skip for paginated requests:

page_1 = client.feedbacks.get({"limit": 20, "skip": 0})
page_2 = client.feedbacks.get({"limit": 20, "skip": 20})
feedbacks = client.feedbacks.get({
"order": "createdAt DESC",
"limit": 10,
})

Return only the fields you need to reduce payload size:

contacts = client.contacts.get({
"fields": {
"id": True,
"email": True,
}
})
result = client.feedbacks.get({
"where": {"companyId": "YOUR_COMPANY_ID"},
"order": "createdAt DESC",
"limit": 50,
"skip": 0,
})