Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

leojquinteros/twitter-api-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twitter-api-sample

Sample API for retrieving stored tweets from a stream. Streaming API reference: https://www.npmjs.com/package/twitter#streaming-api

Starting MongoDB service

$ sudo service mongod start

Running the project

$ npm install
$ npm start

Get Tweets

Retrieve tweets stored in the database.

  • URL: http://localhost:3000/api/tweets

  • Method: GET

  • Query Params

    user=[string] [Filter] The user name of the tweet.
    hashtag=[string] [Filter] A hashtag in the tweet.
    mention=[string] [Filter] A user mention in the tweet.
    size=[integer] The page size. Possible values are: 30, 50, 100, or blank for retrieving all.

  • Success response:

    • Code: 200
      Content:

      [
          {
              "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit @userMention1",
              "username": "username1",
              "userMentions": [
                  "userMention1"
              ],
              "hashtags": []
          },
          {
              "text": "Lorem ipsum dolor sit amet #hashtag1 #hashtag2",
              "username": "username2",
              "userMentions": [],
              "hashtags": [
                  "hashtag1",
                  "hashtag2"
              ]
          }
      ]
  • Other responses:

    • Code: 404 Not Found
      Content:

      {
          "successful": false,
          "error": "Tweet not found."
      }
    • Code: 400 Bad Request
      Content:

      {
          "successful": false,
          "error": "Invalid page size. Possible values are 30, 50, 100 or leave it blank to retrieve all tweets."
      }

Releases

No releases published

Packages

No packages published