Medias API
The main purpose of this API is to retrieve medias.
The production url for this API is https://nap.launchmetrics.com/medias/v1
Authentication
All apis contain the /v[:version] placeholder. It’s used to do API versioning
-
v0 For testing environments, no authentication is required and it’s disabled on production
-
v1 Production version, authentication required
There are two ways to authenticate the request
-
with just an app_id parameter (if you don’t have an app_id you should request one) (less secure)
-
with an app_id + signature parameters (signature creation explained below) (more secure)
The use of appId or appid is deprecated, use app_id instead
The testing environment is not up 24/7, so some calls to the testing urls may return 404
Create a signature
This method is inspired from https://dev.twitter.com/docs/auth/creating-signature
To sign a request you need:
-
http method in uppercase: GET, POST
-
Request url without parameters
-
The parameter string, a url-encoded and sorted parameters string (see below to know how to generate it)
-
Body bytes content, if you’re not sending form data
-
Current timestamp (in seconds)
-
A nonce, in other words, a random string which have at least 32 characters
-
An app_id provided by R&D
-
A secret (related to the app) provided by R&D
For example, given this parameters as key and values:
{ “query”: “girona”, "period: “last_month”, }
Step 1, add the timestampp, nonce and app_id:
{ “query”: “girona”, “period”: “last_month”, “timestamp”: “1380545928”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “app_id”: “3ttp2946sij2hic” }
Step 2, percent encode all keys and values
{ “query”: “girona”, “period”: “last_month”, “timestamp”: “1380545928”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “app_id”: “3ttp2946sij2hic” }
Make sure your percent encode library encode spaces as %20 instead of +. Using the + sign will generate an incorrect signature.
Step 3, join the key and value using a = and sort the parameters alphabetically
[ “app_id=3ttp2946sij2hic”, “nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “period=last_month”, “query=girona”, “timestamp=1380545928” ]
Step 4, join all parameters with & to generate the parameter_string
app_id=3ttp2946sij2hic&nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D&period=last_month&query=girona×tamp=1380545928
Step 5, generate the signature_base string using this schema
signature_base = http_method&url_encoded(request_url)&url_encoded(parameter_string)
Step 6, if you’re sending not form data on body(p.e. a json or plain text), add body bytes after a new line
signature_base = signature_base + “\n” + ‘{“json”: “example”}’
where
-
http_method is the http method used for the request in uppercase: GET
-
request_url is the url without parameters and without the protocol, for example nap.aws.augure.com/v1/search/influencers
-
parameter_string is explained above, for example app_id=3ttp2946sij2hic&nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D&period=last_month&query=girona×tamp=1380545928
Then the signature_base string will be:
GET&nap.aws.augure.com%2Fv1%2Fsearch%2Finfluencers&app_id%3D3ttp2946sij2hic%26nonce%3DQC3hTWyVby6PtKKeCnxPAEMPXebUP82D%26period%3Dlast_month%26query%3Dgirona%26timestamp%3D1380545928 {“json”: “example”}
don’t forget to url_encode the request_url and the parameter_string
Step 6, generate the signature parameter using the HMAC_SHA1 algorithm. This algorithm needs 2 strings to work, the first one will be the signature_base string, and the second one will be the secret (needed to generate the secure hash).
The output of this algorithm is binary, so you should use base64 encoding to produce the final signature string.
If the secret provided for our app is rpii62atrbqejx27v7uv32qbn8exv7gj then the signature of our request will be
OHQRsFL3dqFIStxxHcv1yY8qcy4=
Step 7, add the signature value to the request parameters and execute the request to the API. In this case will be
{ “query”: “girona”, “period”: “last_month”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “timestamp”: “1380545928”, “app_id”: “3ttp2946sij2hic”, “signature”: “OHQRsFL3dqFIStxxHcv1yY8qcy4=” }
Don’t forget, if you’re not using a helper library, you should url encode all keys and values.
For the POST and PUT requests which you’re not sending form data, like a json or plain text, the parameters related to the signature must be added to the url, p.e.: https://nap.launchmetrics.com/v1/analysis?app_id=xxx&nonce=xxx×tamp=xxx&signature=xxx
Response
All responses return application/json; charset=utf-8.
-
Response ok (application/json)
The response element will contain the specific API method response.
{ "status": "200", "time": "0.2", "request": { "method":"GET", "path":"/ping", "parameters": {} }, "response": {} } -
Response error (application/json)
There could be different messages with the correspondent HTTP error code.
{ "status": "404", "time": "0.2", "request": { "method":"GET", "path":"/ping", "parameters": {} }, "error": { "code": "WRONG_PARAMETERS", "message": "The email parameter is mandatory" } }
Generic Error codes
-
Http status 400
-
MISSING_PARAMETERS
Some error with the API parameters
-
-
Http status 500
-
INTERNAL_ERROR
Unexpected API error
-
API Health ¶
There are two default methods available for each API for monitoring purposes.
Ping ¶
PingGET/ping
Used to know if the API is up and working
Example URI
200Headers
Content-Type: application/jsonBody
{
"pong": "ok"
}Stats ¶
StatsGET/stats
It displays information about the API usage and how it performs
Example URI
200Headers
Content-Type: application/jsonBody
{
"last24hours": {
"GET /emailValidation/v1/setEmailStatus": {
"hour_interval": [
{
"hour": "2016-02-18T16:00:00.000Z",
"count": 2,
"variance": 0,
"status": {
"EMAIL_NOT_FOUND": {
"count": 2,
"variance": 0,
"std_deviation": 0,
"avg": 0.168862000107765,
"min": 0.168862000107765,
"max": 0.168862000107765,
"sum_of_squares": 0.0570287501607898,
"std_deviation_bounds": {
"upper": 0.168862000107765,
"lower": 0.168862000107765
},
"sum": 0.33772400021553
},
"OK": {
"count": 0,
"variance": null,
"std_deviation": null,
"avg": null,
"min": null,
"max": null,
"sum_of_squares": null,
"std_deviation_bounds": {
"upper": null,
"lower": null
},
"sum": null
}
},
"min": 0.168862000107765,
"avg": 0.168862000107765,
"std_deviation": 0,
"max": 0.168862000107765,
"sum_of_squares": 0.0570287501607898,
"sum": 0.33772400021553,
"std_deviation_bounds": {
"upper": 0.168862000107765,
"lower": 0.168862000107765
}
},
{
"hour": "2016-02-18T18:00:00.000Z",
"count": 2,
"variance": 0,
"status": {
"EMAIL_NOT_FOUND": {
"count": 2,
"variance": 0,
"std_deviation": 0,
"avg": 0.0233999993652105,
"min": 0.0233999993652105,
"max": 0.0233999993652105,
"sum_of_squares": 0.00109511994058371,
"std_deviation_bounds": {
"upper": 0.0233999993652105,
"lower": 0.0233999993652105
},
"sum": 0.0467999987304211
},
"OK": {
"count": 0,
"variance": null,
"std_deviation": null,
"avg": null,
"min": null,
"max": null,
"sum_of_squares": null,
"std_deviation_bounds": {
"upper": null,
"lower": null
},
"sum": null
}
},
"min": 0.0233999993652105,
"avg": 0.0233999993652105,
"std_deviation": 0,
"max": 0.0233999993652105,
"sum_of_squares": 0.00109511994058371,
"sum": 0.0467999987304211,
"std_deviation_bounds": {
"upper": 0.0233999993652105,
"lower": 0.0233999993652105
}
},
{
"hour": "2016-02-18T20:00:00.000Z",
"count": 2,
"variance": 0,
"status": {
"EMAIL_NOT_FOUND": {
"count": 2,
"variance": 0,
"std_deviation": 0,
"avg": 0.0268389992415905,
"min": 0.0268389992415905,
"max": 0.0268389992415905,
"sum_of_squares": 0.00144066376058019,
"std_deviation_bounds": {
"upper": 0.0268389992415905,
"lower": 0.0268389992415905
},
"sum": 0.053677998483181
},
"OK": {
"count": 0,
"variance": null,
"std_deviation": null,
"avg": null,
"min": null,
"max": null,
"sum_of_squares": null,
"std_deviation_bounds": {
"upper": null,
"lower": null
},
"sum": null
}
},
"min": 0.0268389992415905,
"avg": 0.0268389992415905,
"std_deviation": 0,
"max": 0.0268389992415905,
"sum_of_squares": 0.00144066376058019,
"sum": 0.053677998483181,
"std_deviation_bounds": {
"upper": 0.0268389992415905,
"lower": 0.0268389992415905
}
}
],
"count": 2068,
"variance": 0.952526547318981,
"min": 18.1012001037598,
"avg": 19.8605297686284,
"std_deviation": 0.975974665305909,
"max": 23.6008319854736,
"sum_of_squares": 817673.073983961,
"std_deviation_bounds": {
"upper": 21.8124790992402,
"lower": 17.9085804380165
},
"sum": 41071.5755615234
}
},
"last15days": {
"GET /emailValidation/v1/setServerEmailsVerificationPending": {
"count": 1,
"variance": 0,
"min": 28.7900829315186,
"avg": 28.7900829315186,
"std_deviation": 0,
"max": 28.7900829315186,
"sum_of_squares": 828.868875203716,
"day_interval": [
{
"count": 1,
"variance": 0,
"status": {
"CONNECTION_ERROR": {
"count": 1,
"variance": 0,
"std_deviation": 0,
"avg": 28.7900829315186,
"min": 28.7900829315186,
"max": 28.7900829315186,
"sum_of_squares": 828.868875203716,
"std_deviation_bounds": {
"upper": 28.7900829315186,
"lower": 28.7900829315186
},
"sum": 28.7900829315186
},
"OK": {
"count": 0,
"variance": null,
"std_deviation": null,
"avg": null,
"min": null,
"max": null,
"sum_of_squares": null,
"std_deviation_bounds": {
"upper": null,
"lower": null
},
"sum": null
}
},
"min": 28.7900829315186,
"avg": 28.7900829315186,
"std_deviation": 0,
"max": 28.7900829315186,
"sum_of_squares": 828.868875203716,
"day": "2016-02-07T00:00:00.000Z",
"sum": 28.7900829315186,
"std_deviation_bounds": {
"upper": 28.7900829315186,
"lower": 28.7900829315186
}
}
],
"std_deviation_bounds": {
"upper": 28.7900829315186,
"lower": 28.7900829315186
},
"sum": 28.7900829315186
}
}
}Custom error codes ¶
Http status 400
-
MEDIA_INVALID_IDS
Ids passed to api are not corrects.
Http status 500
-
MEDIA_LOAD_ERROR
The load process has failed.
Online Medias Collection ¶
Media retrieval ¶
MediasGET/medias/{ids}
Method used to get medias data.
If you want to retrieve a lot of medias, please use the next method instead
Example URI
- ids
number(required) Example: 968427630The medias ids you want to retrieve. It can be one or more separated by comas.
If one or more of these medias aren’t in our database, it won’t be returned
200Headers
Content-Type: application/jsonBody
[
{
"typology": {
"name": "Online Media",
"id": "0"
},
"location": {
"country": {
"name": "Spain",
"id": "0100",
"code": "ES"
},
"continent": {
"name": "Europe",
"id": "01"
},
"region": {
"name": "Catalonia",
"id": "010001"
},
"subregion": {
"name": "Barcelona",
"id": "01000102"
}
},
"language": {
"name": "spanish",
"id": "0",
"code": "es"
},
"average_daily_saved_articles": "5091.1290",
"status": "1",
"agency_id": null,
"origin": "imente",
"description": "Publicación generalista con noticias de actualidad",
"generic_email": "redaccion@lavanguardia.es",
"is_in_google_news": "YES",
"searchers": [
"LaVanguardia.es",
"http://www.lavanguardia.es",
"http://blogs.lavanguardia.com",
"http://juegosolimpicos.lavanguardia.com",
"http://endirecto.lavanguardia.com",
"http://www.lavanguardia.com/alminuto",
"http://www.lavanguardia.com/local/aragon.html",
"http://www.lavanguardia.com/local/valles-occidental.html",
"http://www.lavanguardia.com",
"http://www.lavanguardia.com/index.html",
"http://www.lavanguardia.com/cultura",
"http://www.lavanguardia.com/index.html",
"http://www.lavanguardia.mobi"
],
"url": "http://www.lavanguardia.com",
"id": "968427630",
"title": "La Vanguardia",
"has_favicon": true,
"rank": {
"alexa_inlinks_host_match": "1",
"alexa_rank": "2125",
"google_pagerank": "7",
"alexa_reach": "678.0000",
"audience": "1968845",
"audience_mode": "ALEXA_REACH",
"alexa_inlinks": "13135",
"google_inlinks": "1020",
"source_rank": "89252",
"advertising_value": "24611",
"alexa_page_views": "2.5000",
"similarweb_monthly_visits": "25611756.0000",
"similarweb_updated_at": "2019-02-11 00:28:19",
"similarweb_applied_correction": "none"
},
"inserted_at": "2000-09-08T17:40:30Z"
}
]MediasPOST/medias/
Same as the previous call, but the ids are sent with the request message body.
Example URI
Headers
Content-Type: text/plainBody
967823904,968325673,995640653,1011612417200Headers
Content-Type: application/jsonBody
[
{
"typology": {
"name": "Corporate/Institucional",
"id": "4"
},
"average_daily_saved_articles": "47.6129",
"status": "1",
"searchers": [],
"agency_id": null,
"modified_at": "2015-06-14T15:22:43Z",
"url": "http://www.acb.com",
"id": "967823904",
"inserted_at": "2000-09-01T17:58:24Z",
"language": {
"name": "spanish",
"id": "0",
"code": "es"
},
"location": {
"country": {
"name": "Spain",
"id": "0100",
"code": "ES"
},
"continent": {
"name": "Europe",
"id": "01"
},
"region": {
"name": "Catalonia",
"id": "010001"
},
"subregion": {
"name": "Barcelona",
"id": "01000102"
}
},
"origin": "imente",
"description": "Web oficial de l\\\\\\\\\\\\\\\\\\\\'ACB. (Baloncesto)",
"generic_email": "",
"is_in_google_news": "YES",
"title": "ACB.COM",
"has_favicon": false,
"rank": {
"alexa_inlinks_host_match": "1",
"alexa_rank": "15852",
"google_pagerank": "5",
"alexa_reach": "82.0000",
"audience": "174268",
"audience_mode": "ALEXA_REACH",
"alexa_inlinks": "1245",
"google_inlinks": "208",
"source_rank": "53631",
"advertising_value": "4688",
"alexa_page_views": "5.3800",
"similarweb_monthly_visits": "1861156.0000",
"similarweb_updated_at": "2019-02-11 00:28:19",
"similarweb_applied_correction": "10"
}
},
{
"typology": {
"name": "Online Media",
"id": "0"
},
"average_daily_saved_articles": "681.3214",
"status": "1",
"searchers": [
"http://www.elmundodeportivo.es"
],
"agency_id": null,
"modified_at": "2016-01-11T12:28:14Z",
"url": "http://www.mundodeportivo.com",
"id": "968325673",
"inserted_at": "2000-09-07T13:21:13Z",
"language": {
"name": "spanish",
"id": "0",
"code": "es"
},
"location": {
"country": {
"name": "Spain",
"id": "0100",
"code": "ES"
},
"continent": {
"name": "Europe",
"id": "01"
},
"region": {
"name": "Catalonia",
"id": "010001"
},
"subregion": {
"name": "Barcelona",
"id": "01000102"
}
},
"origin": "twingly_no_capturar",
"description": "",
"generic_email": "redaccion@mundodeportivo.com",
"is_in_google_news": "YES",
"title": "Mundo Deportivo",
"has_favicon": true,
"rank": {
"alexa_inlinks_host_match": "1",
"alexa_rank": "2100",
"google_pagerank": "6",
"alexa_reach": "696.0000",
"audience": "2110735",
"audience_mode": "ALEXA_REACH",
"alexa_inlinks": "2893",
"google_inlinks": "368",
"source_rank": "78668",
"advertising_value": "25012",
"alexa_page_views": "2.3700",
"similarweb_monthly_visits": "611756.0000",
"similarweb_updated_at": "2019-02-11 00:28:19",
"similarweb_applied_correction": "none"
}
},
{
"typology": {
"name": "Online Media",
"id": "0"
},
"average_daily_saved_articles": "996.4839",
"status": "1",
"searchers": [
"travel.nytimes.com",
"movies.nytimes.com",
"takingnote.blogs.nytimes.com",
"opinionator.blogs.nytimes.com",
"dealbook.nytimes.com",
"realestate.nytimes.com",
"tv.nytimes.com",
"theater.nytimes.com",
"topics.nytimes.com",
"wheels.blogs.nytimes.com",
"http://dealbook.blogs.nytimes.com",
"http://global.nytimes.com"
],
"agency_id": null,
"modified_at": "2016-01-11T12:28:18Z",
"url": "http://www.nytimes.com",
"id": "995640653",
"inserted_at": "2001-07-20T16:50:53Z",
"language": {
"name": "english",
"id": "2",
"code": "en"
},
"location": {
"country": {
"name": "USA",
"id": "0400",
"code": "US"
},
"continent": {
"name": "North America",
"id": "04"
},
"region": {
"name": "New York",
"id": "040012"
}
},
"origin": "imente",
"description": "Principal diari de New york\r\n",
"generic_email": "",
"is_in_google_news": "YES",
"title": "The New York Times",
"has_favicon": true,
"rank": {
"alexa_inlinks_host_match": "1",
"alexa_rank": "111",
"google_pagerank": "9",
"alexa_reach": "11320.0000",
"audience": "30544139",
"audience_mode": "ALEXA_REACH",
"alexa_inlinks": "414195",
"google_inlinks": "6020",
"source_rank": "100000",
"advertising_value": "365002",
"alexa_page_views": "2.3900",
"similarweb_monthly_visits": "18622756.0000",
"similarweb_updated_at": "2019-02-11 00:28:19",
"similarweb_applied_correction": "1"
}
},
{
"typology": {
"name": "Online Media",
"id": "0"
},
"average_daily_saved_articles": "2.5000",
"status": "1",
"searchers": [
"http://www.thesun.co.uk/sol/homepage/"
],
"agency_id": null,
"modified_at": "2016-01-11T12:28:20Z",
"url": "http://www.thesun.co.uk",
"id": "1011612417",
"inserted_at": "2002-01-21T12:26:57Z",
"language": {
"name": "english",
"id": "2",
"code": "en"
},
"location": {
"country": {
"name": "United Kingdom",
"id": "0103",
"code": "GB"
},
"continent": {
"name": "Europe",
"id": "01"
}
},
"origin": "imente",
"description": "Rotativo sensacionalista inglés",
"generic_email": null,
"is_in_google_news": "YES",
"title": "The Sun",
"has_favicon": false,
"rank": {
"alexa_inlinks_host_match": "1",
"alexa_rank": "6589",
"google_pagerank": "7",
"alexa_reach": "260.0000",
"audience": "610390",
"audience_mode": "ALEXA_REACH",
"alexa_inlinks": "20962",
"google_inlinks": "952",
"source_rank": "71122",
"advertising_value": "5860",
"alexa_page_views": "1.9200",
"similarweb_monthly_visits": "18611756.0000",
"similarweb_updated_at": "2019-02-10 00:28:19",
"similarweb_applied_correction": "10"
}
}
]Online Medias Search ¶
Media retrieval ¶
SearchGET/medias/search?{query,response_type,limit}
Method used to search medias by name.
Example URI
- query
string(required)The query name you want to search.
- response_type
string(optional) Default: defaultAllow to change results format.
Choices:
defaultautocompleter- limit
number(optional) Default: 20 Example: 10Number max of medias to return
Search without specific response_typeBody
search?query=lavanguardia200Headers
Content-Type: application/jsonBody
{
"numFound": 21,
"medias": [
"1245440688",
"968427630",
"1368723499",
"1301666810",
"1301666898",
"1301666997",
"1301674007",
"1301674013",
"1301674022",
"1301674113",
"1301688374",
"1301688469",
"1301695586",
"1301695666",
"1301702824",
"1301717195",
"1301717272",
"1384060815",
"1386351534",
"1389741723"
]
}Search with specific response_typeBody
search?query=lavanguardia&response_type=autocompleter200Headers
Content-Type: application/jsonBody
{
"numFound": 21,
"medias": [
{
"url": "http://lavanguardia-online.blogspot.com",
"name": "Lavanguardia",
"id": "1245440688"
},
{
"url": "http://www.lavanguardia.com",
"name": "LaVanguardia.com",
"id": "968427630"
},
{
"url": "http://psicomunicacionpucv.blogspot.com",
"name": "'La vanguardia'",
"id": "1368723499"
},
{
"url": "http://elmadridista.lavanguardia.es",
"name": "elmadridista.lavanguardia.es",
"id": "1301666810"
},
{
"url": "http://elsporting.lavanguardia.es",
"name": "elsporting.lavanguardia.es",
"id": "1301666898"
},
{
"url": "http://elblaugrana.lavanguardia.es",
"name": "elblaugrana.lavanguardia.es",
"id": "1301666997"
},
{
"url": "http://elespanyol.lavanguardia.es",
"name": "elespanyol.lavanguardia.es",
"id": "1301674007"
},
{
"url": "http://elracinguista.lavanguardia.es",
"name": "elracinguista.lavanguardia.es",
"id": "1301674013"
},
{
"url": "http://elmalaga.lavanguardia.es",
"name": "elmalaga.lavanguardia.es",
"id": "1301674022"
},
{
"url": "http://elbetis.lavanguardia.es",
"name": "elbetis.lavanguardia.es",
"id": "1301674113"
},
{
"url": "http://elrecre.lavanguardia.es",
"name": "elrecre.lavanguardia.es",
"id": "1301688374"
},
{
"url": "http://elatleti.lavanguardia.es",
"name": "elatleti.lavanguardia.es",
"id": "1301688469"
},
{
"url": "http://eldepor.lavanguardia.es",
"name": "eldepor.lavanguardia.es",
"id": "1301695586"
},
{
"url": "http://elvalencianista.lavanguardia.es",
"name": "elvalencianista.lavanguardia.es",
"id": "1301695666"
},
{
"url": "http://elgetafe.lavanguardia.es",
"name": "elgetafe.lavanguardia.es",
"id": "1301702824"
},
{
"url": "http://elnumancia.lavanguardia.es",
"name": "elnumancia.lavanguardia.es",
"id": "1301717195"
},
{
"url": "http://elvalladolid.lavanguardia.es",
"name": "elvalladolid.lavanguardia.es",
"id": "1301717272"
},
{
"url": "http://girondounpoeta.blogspot.com",
"name": "'la vanguardia'",
"id": "1384060815"
},
{
"url": "http://lavanguardia-catalunya.blogspot.com",
"name": "'La vanguardia'",
"id": "1386351534"
},
{
"url": "http://manuelyasociados.blogspot.com",
"name": "'LA VANGUARDIA'",
"id": "1389741723"
}
]
}Search without matching resultsBody
search?query=nomatchingresultsquery200Headers
Content-Type: application/jsonBody
{
"numFound": 0,
"medias": []
}Print Medias Search ¶
Media retrieval ¶
SearchGET/medias/print/search?{query,response_type,limit}
Method used to search medias by name.
Example URI
- query
string(required)The query name you want to search.
- response_type
string(optional) Default: defaultAllow to change results format.
Choices:
defaultautocompleter- limit
number(optional) Default: 20 Example: 10Number max of medias to return
Search without specific response_typeBody
search?query=vogue200Headers
Content-Type: application/jsonBody
{
"numFound": 3,
"medias": [
"10122",
"11595",
"12884"
]
}Search with specific response_typeBody
search?query=vogue&response_type=autocompleter200Headers
Content-Type: application/jsonBody
{
"numFound": 3,
"medias": [
{
"id": "10122",
"name": "Vogue JAP - Bag & Shoes",
"frequency": "Biannual",
"type": "Magazine"
},
{
"id": "11595",
"name": "Vogue IND",
"frequency": "Monthly",
"type": "Magazine"
},
{
"id": "12884",
"name": "Vogue RUS - Beauty",
"frequency": "Annual",
"type": "Magazine"
}
]
}Search without matching resultsBody
search?query=nomatchingresultsquery200Headers
Content-Type: application/jsonBody
{
"numFound": 0,
"medias": []
}