Fetch mentions

GET /accounts/{account_id}/alerts/{alert_id}/mentions

Parameters

  • account_id (string) - Id of the account
  • alert_id (number) - Id of the alert

Page content


Minimal curl example

curl -ig 'https://web.mention.net/api/accounts/{account_id}/alerts/{alert_id}/mentions' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -H 'Accept-Version: 1.9'

Available properties

Most interesting part of this method is the querystring, where you can apply a range of filters. All filters are optional.

Properties index_version Definition Example
since_id 1+ Return mentions with an id upper (more recent) than given id 52638
before_date 1+ Return mentions older than given date 2011-11-16T19:20:30.12345+01:00
not_before_date 1+ Ignore mentions older than given date (only allowed when before_date if provided) 2011-11-16T19:20:30.12345+01:00
limit 1+ Number of mentions to return (default 20, max 100). Use a small limit to get faster response times. 20
type 1+ One of "default", "favorites", "trashed" favorites
source 1+ One of available sources web
unread 1+ Boolean (1 for true, 0for false) 1
q 1+ / 2+ Special parameter that makes it possible to make more advanced requests source:(facebook OR twitter) in:(inbox OR archive)

since_id and before_date cannot be used in the same time.

type and source cannot be used in the same time.

Column index_version

It indicates the search version from which a specific property was made available in mention filters. For instance, unread was made available only since index_version: 2. You will know this index_version of an Alert by fetching it.

Pagination

Retrieving older mentions should be done using the before_date parameter.

Pulling for new mentions should be done using the since_id parameter

since older mentions can be discovered after newer ones, ids and publication dates are not necessarily in the same order).

Since id

since_id

This query string attribute indicates that you want to fetch only mentions with an ID upper than the given id. This will therefore only retrieve mentions fetched more recently by our application.

Before date

before_date

Return mentions older than provided date. NB: has usual date format except that timezone offset must be specified.

Not before date

not_before_date

Ignore mentions older than provided date. This parameter is allowed only if before_date is provided. NB: has usual date format except that timezone offset must be specified.

Limit

limit

This is the limit of mentions you want to fetch.

Type

type

One of default, favorite or trashed.

Source

source

Specify this parameter if you want to retrieve only mentions fetched from specific sources. For a list of sources, check the app/data.

Unread

unread

Specify this parameter if you want to retrieve only unread mentions.

Q parameter

q

Whenever possible you should use query string parameters. However, there is also a special querystring parameter : q. It gives access to more advanced searches.

You should avoid using q and direct query string parameters in the same request, or you might end up with unstable results. If it seems that you have to use a q query, stick to it for all parameters possible.

Q is a bit more "low level", as it gives access to a pseudo-search language.

It is not available for all plans. Only 'growth plans' and more can use this feature.

Example:

q=source:(facebook OR twitter) in:(inbox OR archive) is:favorite tone:(neutral OR positive) language:en published_at:[2015-12-01 TO 2015-12-31]

When you use the webapp, and search for mentions, you can filter mentions. This comes down to using this feature, and if you try, you will see that the when you search, a query appears in the search box. It is written in this pseudo-search language. It may be a good start for you in order to know what search you can or cannot do.

Below, the q elements which are available only for index_version superior to 1.

q element index version
is:unread 2+

Request example

  • Headers
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept-Version: 1.9
  • Body

None


Response example

  • Body
{
    "mentions":[
        {...mention...},
        {...mention...},
        ...
    ],
    "_links":{
        "more":{
            "href": "...url to get older mentions..."
        },
        "pull":{
            "href": "...url to get newer mentions..."
        }
    }
}