Skip to content

Latest commit

 

History

History
87 lines (62 loc) · 3.42 KB

searches.md

File metadata and controls

87 lines (62 loc) · 3.42 KB

Searches

These endpoints allow you to create, edit, and delete searches.

View the official documentation here.

Table of Contents

Methods

emma.search.list(callback)

Retrieve a list of saved searches.

  • params <Object> Can have the following fields:
    • deleted <Boolean> Optional. Flag to include deleted searches.
  • returns: An array of searches

emma.search.create([params], callback)

Create a saved search. The detail of a search is specified in a JSON structure that describes the clauses to be applied using groups of filter type, operator and value. Where the filter type is member_field, the referenced field should be specified by joining with a colon. For example:

["and",
    ["or",
        ["group", "eq", "my list"],
        ["group", "contains", "old"]
    ],
    ["not", ["member_field", "soup", "eq", "lentil"]],
    ["opened", 123249, "between", "2011-01-22, 2011-01-31"],
    ["clicked", 83927]
]
  • params <Object> Can have the following fields:
    • criteria <Array> A combination of search conditions, as described above.
    • name <String> A name used to describe this search.
  • returns: The id of the new search.
  • raises: Http404 if search is invalid.

emma.search.withID(id).details([params], callback)

Get the details for a saved search.

  • params <Object> Can have the following fields:
    • deleted <Boolean> Optional. Flag to include deleted searches.
  • returns: A search.
  • raises: Http404 if the search does not exist.

emma.search.withID(id).update([params], callback)

Update a saved search. No parameters are required, but either the name or criteria parameter must be present for an update to occur.

  • params <Object> Can have the following fields:
    • criteria <Array> A combination of search conditions, as described above.
    • name <String> A name used to describe this search.
  • returns: True if update was successful.
  • raises: Http404 if the search does not exist or if search criteria is invalid.

emma.search.withID(id).members(callback)

Get the members matching the search.

  • returns: An array of members.
  • raises: Http404 if the search does not exist.

emma.search.withID(id).delete(callback)

Get the details for a saved search.

  • params <Object> Can have the following fields:
    • deleted <Boolean> Optional. Flag to include deleted searches.
  • returns: A search.
  • raises: Http404 if the search does not exist.