You can use the Mentionlytics API to get your mention results in JSON format to use it in your applications.

How to get your Token to access the API

In order to get the required token to access the API, use the following url after replacing your email and password in the parameters:

https://
app.mentionlytics.com/api/token?email=xxxx&password=yyyy

The result will be something like this:

{"token":"xxxxxxxxxx","user_id": xxx}

Copy and keep your token to use it in your calls. 

Please note that your token will change if you change your password in Mentionyltics, in which case you will simply need to repeat the above process to get a new token. 

How to use the API 

It is very easy to make API calls now that you have your token.

The simplest call you can make is:

https://
app.mentionlytics.com/api/mentions?token=xxxxxxxxx

Where you will get you latest Brand Monitoring results for the past 7 days. This is the default bahaviour and will return a JSON stream. 

For Example:

{"mentions":[
{"id":1000886319,"pub_date":"2019-01-24T00:00:00.000Z",
"cmeta":{"likes":0,"views":0,"comments":0,"retweets":0,"fb_shares":0,"pin_shares":0,"plus_shares":0,"linked_shares":0},
"uid":603644472,"profile_name":"grape surgeon ","screen_name":"drugtraffiqueen","profile_username":"drugtraffiqueen","profile_image":"https://pbs.twimg.com/profile_images/959928653806227462/gYahTI6i_normal.jpg","profile_image_url":null,"profile_uu_id":"2357365475","followers_count":85,"country":null,"profile_meta":"{\"location\":\"Clare, Ireland\"}","meta_count1":94,"post_count":1952,"profile_description":"hi I'm Becky and you're watching Disney Channel","profile_meta_count1":94,"profile_type_name":null,"statuses_count":1952,"name":"grape surgeon ","image":null,"mRank":85,"campaign":"Ryanair Keywords","commtrack":"ryanair","total_count":2202,"likes":0,"views":0,"comments":0,"retweets":0,"fb_shares":0,"pin_shares":0,"plus_shares":0,"linked_shares":0,"_id":1000886319,"msearch_id":11082830,"commtrack_id":"31016","campaign_id":9577,"account_id":4529,"mchannel_id":2,"cf1i":3016,"lang_detected":"en","cf1s":null,"body":"RT @Ryanair: The music class from St Brendan’s College in Killarney had their Irish trad instruments with them on yesterday's flight from L…","description":"RT @Ryanair: The music class from St Brendan’s College in Killarney had their Irish trad instruments with them on yesterday's flight from L…","uu_id":"1088587221135998976","profile_id":603644472,"pub_datetime":"2019-01-24T23:59:53.000Z","sentiment_text":"neutral","sentiment_score":0.5,"sentiment_provider":6,"thumb_url":null,"cf2s":"RT"},
{"id":1000886475,"pub_date":"2019-01-24T00:00:00.000Z",
"cmeta":{"likes":0,"views":0,"comments":0,"retweets":0,"fb_shares":0,"pin_shares":0,"plus_shares":0,"linked_shares":0},
"uid":4993368,"profile_name":"Michael Stang","screen_name":"stang_michael","profile_username":"stang_michael","profile_image":"https://pbs.twimg.com/profile_images/476375802687545344/BzVyxP9j_normal.jpeg","profile_image_url":null,"profile_uu_id":"2375531893","followers_count":8173,"country":"N/A","profile_meta":"{\"location\":\"\"}","meta_count1":8555,"post_count":103638,"profile_description":"Enjoy outdoors camping and fishing.","profile_meta_count1":8555,"profile_type_name":null,"statuses_count":103638,"name":"Michael Stang","image":null,"mRank":8173,"campaign":"Ryanair Keywords","commtrack":"ryanair","total_count":2202,"likes":0,"views":0,"comments":0,"retweets":0,"fb_shares":0,"pin_shares":0,"plus_shares":0,"linked_shares":0,"_id":1000886475,"msearch_id":11082903,"commtrack_id":"31016","campaign_id":9577,"account_id":4529,"mchannel_id":2,"cf1i":2,"lang_detected":"en","cf1s":null,"body":"RT @thetravelradar_: DE-IZN @easyJet lining up for takeoff \nWhich low-cost airline do you like best from @easyJet & @Ryanair?\n\nLet us know…","description":"RT @thetravelradar_: DE-IZN @easyJet lining up for takeoff \nWhich low-cost airline do you like best from @easyJet & @Ryanair?\n\nLet us know…","uu_id":"1088580872964468736","profile_id":4993368,"pub_datetime":"2019-01-24T23:34:39.000Z","sentiment_text":"positive","sentiment_score":0.8788772821426392,"sentiment_provider":6,"thumb_url":null,"cf2s":"RT"}],
"totals":[
{"pub_date":"2019-01-24T00:00:00.000Z","total_count":2202},
{"pub_date":"2019-01-23T00:00:00.000Z","total_count":1490}]
}

Limiting results by Date

If you want to specify the date range for which the results will be returned, you can use the StartDate and EndDate parameters.
For example, the following call: 

https://
app.mentionlytics.com/api/mentions?token=xxxxxxxxx&startDate=20190129&endDate=20190227

Will return only mentions from Brand Monitoring Mention Tracker (default tracker) within the range of 2019-01-29 (January 29, 2019) to 2019-02-27 (February 27, 2019).


Getting the Next Results Page

Each API call will return a page of a maximum of 50 mention results. To navigate to the next 50 results you will need to add the query parameter "page_no=[page number]" at your url call. Please note that the first page is 0, then 1 etc. For example: 

https://
app.mentionlytics.com/api/mentions?token=xxxxxxxxx&startDate=20190129&endDate=20190227&page_no=0

The above call will return the first page of extra 50 results beyond the first 50 results (which is page 0 - default). 

Alternatively, you can use the "page" parameter which will get you 50 mentions, starting from the mention number you indicate. So, using page=0 will get you the first 50 mentions (1-50) while page=5 will get you mentions from 6 to 55 etc. 

Advanced Filtering of the results

In order to make more complete queries, you can utilize all the filters available in Mentionlytics UI filters bar. 

So, an easy way to find the filters you want to use is simply go to the Menitonlytics UI and filter your results as desired. In the above example, we filtered for only Twitter results, with negative Sentiment, for our Brand Monitoring Mention tracker and one of the competitors. 

You will notice that the url will change accordingly to the filters to:

https://
app.mentionlytics.com/#/startDate=20190129&endDate=20190227&channels=%5B2%5D&commtracks=%2231016$31021$31017$31018$31019$31020$31022$31023$31024$31025$31027%22&sentiment=negative

So, these are the parameters you can also use in your API calls to get the same filtering! As you can see it is quite robust and offers the same functionality as the Mentionlytics UI.

So the API call for this would look like:

https://
app.mentionlytics.com/api/mentions?token=xxxxxxxxx&startDate=20190129&endDate=20190227&channels=%5B2%5D&commtracks=%2231016$31021$31017$31018$31019$31020$31022$31023$31024$31025$31027%22&sentiment=negative

You can find a detailed guide of all the endpoints, parameters and fields of the Mentionlytics API here.

Did this answer your question?