Grepvine: API

Dataset

ResourceDescription
/stats

Articles

ResourceDescription
/articles/recent
/articles/search
/articles/lookup
/articles/[id]/comments
/articles/[id]/related_articles

Comments

ResourceDescription
/comments/search
/comments/random
/comments/on_related_articles
/comments/[id]/subcomments

Grepvine: API Documentation

GET /stats

Example Request

      /stats.json
    
      {
        "by_source": {
          "engadget": {
            "comments_count": 54810,
            "articles_count": 207
          },
          "mashable": {
            "comments_count": 1633,
            "articles_count": 144
          },
          "wired": {
            "comments_count": 3111,
            "articles_count": 127
          }
        },
        "comments_count": 59554,
        "articles_count": 478
      }
    

GET /articles/recent

Parameters

ParameterDescription
num optional

Example Request

      /articles/recent.json?num=1
    
      {
        "articles": [
          {
            "id": "id-string",
            "site": "example",
            "title": "This is title",
            "url": "http://example.com/post",
            "author": "foo",
            "posted_at": "2012-03-10T09:14:22Z",
            "comments_count": 5,
          }
        ]
      }
    

GET /articles/lookup

Parameters

ParameterDescription
url required URL of an article to look up.

Example Request

      /articles/lookup.json?url=http://example.com/post
    
      {
        "article": {
          "id": "id-string",
          "site": "example",
          "title": "This is title",
          "url": "http://example.com/post",
          "author": "foo",
          "posted_at": "2012-03-10T09:14:22Z",
          "comments_count": 5,
        }
      }
    

GET /articles/[id]/comments

Article ID is included in responses of /articles/lookup or /articles/search

Parameters

ParameterDescription
sort optional The field for sorting comments. One of popular, recent, active, wordcount, controversial, random
(Default: popular)
offset optional
num optional The number of comments to retrieve.
highlighted optional If it is set to "true" or "false", filter the result.

Example Request

      /articles/[id]/comments.json
    
      {
        "article": { // same with /articles/lookup
          "id": "id-string",
          "site": "example",
          "title": "This is title",
          "url": "http://example.com/post",
          "author": "foo",
          "posted_at": "2012-03-10T09:14:22Z",
          "comments_count": 5,
        },
        "comments": [
          {
            "id": "id-string",
            "site": "example",
            "body": "lorem ipsulm",
            "posted_at": "2012-03-10T09:14:22Z",
            "author": "name",
            "author_url": "http://example.com",
            "author_avatar_url": "http://example.com/avatar.jpg",
            "subcomments_count": 0,
            "depth": 0,
            "up": 5,
            "down": null,
            "wordcount": 2,
          }
        ]
      }
    

GET /articles/[id]/related_articles

Parameters

ParameterDescription
sort optional The field for sorting comments. One of relevancy, comments, recommended_comments, recent, random
(Default: relevancy)
offset optional
num optional

Example Request

      /articles/[id]/related_articles.json?sort=popular
    
      {
        "total_results": 1,
        "next_offset": 1,
        "articles": [
          {
            "id": "id-string",
            "site": "example",
            "title": "This is title",
            "url": "http://example.com/post",
            "author": "foo",
            "posted_at": "2012-03-10T09:14:22Z",
            "comments_count": 5,
            "score": 0.142,
          }
        ]
      }
    

GET /comments/random

Parameters

ParameterDescription
num optional

Example Request

      /comments/random.json?num=1
    
      {
        "comments": [
          {
            "id": "id-string",
            "site": "example",
            "body": "lorem ipsulm",
            "posted_at": "2012-03-10T09:14:22Z",
            "author": "name",
            "author_url": "http://example.com",
            "author_avatar_url": "http://example.com/avatar.jpg",
            "subcomments_count": 0,
            "depth": 0,
            "up": 5,
            "down": null,
            "wordcount": 2,
            "article": {
              "id": "id-string",
              "site": "example",
              "title": "This is title",
              "url": "http://example.com/post",
              "author": "foo",
              "posted_at": "2012-03-10T09:14:22Z",
              "comments_count": 5,
            }
          }
        ]
      }
    

GET /comments/[id]/subcomments

Example Request

      /comments/[id]/subcomments.json
    
      {
        "comments": [
          {
            "id": "id-string",
            "site": "example",
            "body": "lorem ipsulm",
            "posted_at": "2012-03-10T09:14:22Z",
            "author": "name",
            "author_url": "http://example.com",
            "author_avatar_url": "http://example.com/avatar.jpg",
            "subcomments_count": 0,
            "depth": 0,
            "up": 5,
            "down": null,
            "wordcount": 2,
          }
        ]
      }
    
© 2012 Grepvine