Search

Search for Posts

Returns Post objects which match a given search query. Searches ordered by id require at least one query or filter to be specified; searches ordered by score require at least one query and zero or more filters to be specified. Searches require an ordering and at least one search query to be specified, and allow for zero or more filters to be added. All parameters should be passed in the query string.

All queries and filters are combined with an AND operation. Query parameters (not filter parameters) can use “quoted strings” for phrases, search syntax like +foo -bar and foo OR baz for boolean queries. Machine-only posts are not included in the search index. Separate lists of terms by spaces.

This endpoint responds to general Post parameters.

Endpoint

Method URL Token
GET https://api.app.net/posts/search Any

General Parameters

Name Required? Type Description
index Optional string Type of index to use. The default (and currently, the only) index is complete, which searches all posts. We may add additional index types later (e.g., an index only of recent posts, for speed.)
order Optional string One of: id (default), score. Searches of ordering id are returned in roughly the same order as other streams. Searches of ordering score are returned by a relevance score.

Search Query Parameters

Name Required? Type Description
query Optional string Automatically attempts to extract hashtags and mentions while searching text. If you do not want this behavior, you can use more specific parameters below.
text Optional string Include posts containing certain text.

Filter Parameters

Name Required? Type Description
hashtags Optional string Only include posts tagged with certain hashtags. Do not include #
links Optional string Only include posts linking to certain URLs
link_domains Optional string Only include posts linking to certain domains. Do not include "www."
mentions Optional string Only include posts mentioning certain users, by username. Do not include @
leading_mentions Optional string Only include posts directed at users, by username. Do not include @
annotation_types Optional string Only include posts with a specific annotation type, e.g., net.app.core.fallback_url
attachment_types Optional string Only include posts with a specific file type attached via the net.app.core.file_list annotation
crosspost_url Optional string Only include posts which are crossposts of a specific URL, via the net.app.core.crosspost annotation
crosspost_domain Optional string Similar to crosspost_url, but only match on the host portion of the URL. Do not include "www."
place_id Optional string Only include posts which are check-ins at a specific place, via the net.app.core.checkin annotation
is_reply Optional int (0 or 1) Only include replies
is_directed Optional int (0 or 1) Only include posts with leading mentions, i.e., posts which were directed at other users
has_location Optional int (0 or 1) Only include posts containing geo coordinates, i.e., tagged with the net.app.core.geolocation annotation
has_checkin Optional int (0 or 1) Only include posts containing place IDs, i.e., tagged with the net.app.core.checkin annotation
is_crosspost Optional int (0 or 1) Only include posts which are crossposts, i.e., tagged with the net.app.core.crosspost annotation
has_attachment Optional int (0 or 1) Only include posts with file attachments
has_oembed_photo Optional int (0 or 1) Only include posts with photo oembed annotations
has_oembed_video Optional int (0 or 1) Only include posts with video (not html5video) oembed annotations
has_oembed_html5video Optional int (0 or 1) Only include posts with html5video oembed annotations
has_oembed_rich Optional int (0 or 1) Only include posts with rich oembed annotations
language Optional string Only include posts with a certain language tagged with the net.app.core.language annotation.
client_id Optional string Only include posts created by a certain app. Use the alphanumeric client_id
creator_id Optional string Only include posts created by a specific user. Use the user ID, not the username
reply_to Optional string Only include immediate replies to a given post ID
thread_id Optional string Only include posts on a specific thread

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/posts/search?hashtags=adnhack&count=-1"
{
  "data": [
    {
      "canonical_url": "https://alpha.app.net/adn/post/914440",
      "created_at": "2012-10-11T19:48:40Z",
      "entities": {
        "hashtags": [
          {
            "len": 8,
            "name": "adnhack",
            "pos": 90
          }
        ],
        "links": [
          {
            "len": 29,
            "pos": 100,
            "text": "http://appnet.eventbrite.com/",
            "url": "http://appnet.eventbrite.com/"
          }
        ],
        "mentions": [

        ]
      },
      "html": "<span itemscope=\"https://app.net/schemas/Post\">If you're in San Francisco on Saturday October 20 and Sunday October 21 come to the first <span data-hashtag-name=\"adnhack\" itemprop=\"hashtag\">#adnhack</span> => <a href=\"http://appnet.eventbrite.com/\">http://appnet.eventbrite.com/</a></span>",
      "id": "914440",
      "machine_only": false,
      "num_replies": 1,
      "num_reposts": 3,
      "num_stars": 3,
      "source": {
        "client_id": "caYWDBvjwt2e9HWMm6qyKS6KcATHUkzQ",
        "link": "https://alpha.app.net",
        "name": "Alpha"
      },
      "text": "If you're in San Francisco on Saturday October 20 and Sunday October 21 come to the first #adnhack => http://appnet.eventbrite.com/",
      "thread_id": "914440",
      "user": "...user object...",
      "you_reposted": false,
      "you_starred": false,
      "pagination_id": "10000"
    }
  ],
  "meta": {
    "code": 200,
    "more": false,
    "count": 1,
    "min_id": "10000",
    "max_id": "10000"
  }
}