Search

GET /api/search/suggestions
get suggestions for a query. Intended for use as autocomplete suggestions

Also see Messages#search, Groups#search, Users#search and Topics#search.

Success Response Code: 200

Params

Param name Description
q
required

string to autocomplete


Value: Must be a String
context_id
optional

id of object to use as context for autocomplete results


Value: Must be a Integer
context_type
optional

object type to scope results to


Value: Must be one of: <code>group</code>, <code>townhall</code>, <code>project</code>, <code>message</code>.
types
optional

list of types to restrict results


Value: Must be one of: <code>Group</code>, <code>Project</code>, <code>Challenge</code>, <code>SkillOption</code>, <code>Topic</code>, <code>TownHall</code>, <code>User</code>.
user_filter
optional

Value: Must be a Hash
user_filter[account_states]
optional

filter results to only include users with the given account states (default=)


Value: Must be one of: <code>active</code>, <code>deactivated</code>.
user_filter[exclude_ids]
optional

list of user ids to exclude from results


Value: Must be an array of any type
user_filter[role]
optional

filter results to only include users with the given role


Value: Must be one of: <code>member</code>, <code>admin</code>.
user_filter[include_categories]
optional

list of additional user categories to include in matching user list (default=[entire_company people_you_follow]


Value: Must be one of: <code>entire_company</code>, <code>people_you_follow</code>.
group_filter
optional

Value: Must be a Hash
group_filter[visibility]
optional

filter to only return public or private groups


Value: Must be one of: <code>public</code>, <code>private</code>.
group_filter[exclude_ids]
optional

list of group ids to exclude from results


Value: Must be an array of any type
group_filter[member_only]
optional

whether to only include groups that the user is a member of


Value: Must be one of: <code>true</code>, <code>false</code>.
group_filter[can_post_only]
optional

whether to only include groups that the user is allowed to post to (default=false)


Value: Must be one of: <code>true</code>, <code>false</code>.
group_filter[exclude_external_facing]
optional

whether to exclude groups that are external facing


Value: Must be one of: <code>true</code>, <code>false</code>.
group_filter[exclude_provisioned]
optional

whether to exclude groups that are provisioned


Value: Must be one of: <code>true</code>, <code>false</code>.
group_filter[max_results]
optional

Set the maximum number of results to return (default=20,max=500)


Value: Must be a Integer

Response Fields

results ordered array of categorized search result entries Array<SuggestionEntry>
results.heading localized label describing the set of suggested entries (ex: "People you follow", "Entire Company") String
results.entries.type (User|Group) type of suggested entry String

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" 'https://demo.socialcast.com/api/search/suggestions.json?q=emily&types\[\]=User'
curl -X GET -v --basic -u "emily@socialcast.com:demo" 'https://demo.socialcast.com/api/search/suggestions.json?q=Setup&types\[\]=Project'

Examples

GET 
200
{
  "results": [
    {
      "heading": "Entire Company",
      "entries": [
        {
          "contact_info": {
            "email": "active'78@socialcast.com"
          },
          "manager": null,
          "custom_fields": [],
          "followable": false,
          "contact_id": null,
          "following_count": 0,
          "followers_count": 0,
          "status_message": null,
          "id": 87,
          "first_name": "Charleston",
          "last_name": "Whatleyson",
          "name": "Charleston Whatleyson",
          "html_name": "Charleston Whatleyson",
          "url": "https://socialcast.socialcast.test/users/87-charlestonwhatleyson",
          "avatars": {
            "is_system_default": true,
            "id": null,
            "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square16-3b951350d61d203ece2fa5dd274fa7bd35275e132c17310d9006514f8839c857.png",
            "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square30-6db66ac25c338d1e548a68465e2723ff63367c2aafbcc01db24c83964056b892.png",
            "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square45-16865426333e244c59076d4f2475b711ed1ff9d12c97f4cf354f373a0170a1fd.png",
            "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square70-1708999e8f1fea583408d7fc64b2177f853e4123bea2ffcf35f4839c8697e0ba.png",
            "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square140-7da7e1d98b33ef152280b1f653cfd80e2db24b01b625a72abc320673eea5af53.png"
          },
          "username": "CharlestonWhatleyson",
          "active": true,
          "terminated": false,
          "inactive": false,
          "role": "member",
          "type": "User",
          "title": null,
          "out_of_office": false,
          "out_of_office_on": null,
          "back_in_office_on": null,
          "company_login": null
        }
      ]
    }
  ]
}