Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Api Example

Prerequisites

node js ^8.9x 
npm ^4.6.
mongodb

Installing

Clona el repositoio

git clone https://github.com/LuisToro/twitter-api.git

Instalas las dependencias

npm install

Ejecuta el proyecto

npm start

Documentation

  • GET api/ : Obtienes el mensaje de bienvenida a la API.

Users

  • GET api/users : Obtienes en formato json unicamente los usuarios habilitados status: true.

  • GET api/users/:id : Obtienes en formato json el usuarios correspondiente al :id enviado como parametro.

    • URL Params id=[integer]
  • POST api/users : Crea un nuevo usuario en base de datos.

    • Data Params:
     status=[Boolean] (default: true)
     firstname=[string] (required) (maxlength: 32)
     lastname=[string] (required) (maxlength: 32)
     email=[string] (required) (maxlength: 64)
    • Example:
     {
     	"firstname": "Git",
     	"lastname": "Hub",
     	"email": "email@github.com"
     }
  • PUT api/users/:id : Edita el usuarios correspondiente al :id enviado como parametro.

    • URL Params id=[string]

    • Data Params:

      status=[Boolean]
      firstname=[string]
      lastname=[string]
      email=[string]
      • Example:
      {
      	"status": true,
      	"firstname": "Git",
      	"lastname": "Hub",
      		"email": "email@github.com"
      }
  • DELETE api/users/:id : Importante: Se realiza un borrado logico, asignando status=false.

    • URL Params id=[string]

Tweets

  • GET api/tweets : Obtienes en formato json todos los tweets almacenados en memoria.

  • GET api/tweets/:id : Obtienes en formato json el tweet correspondiente al :id enviado como parametro.

    • URL Params id=[integer]
  • POST api/tweets : Crea un nuevo tweet en memoria.

    • Data Params:
     content=[string] (required) 
     author=[string] (required) (ref: 'user') user id
     location=[string] (required) 
    • Example:
     {
     	"content": "Introducing new ways to build with GitHub Enterprise 2.12",
     	"author": "5a63bc11d560cc3684ce5122",
     	"location": "Silicon Valley"
     }
  • PUT api/tweets/:id : Edita el tweet correspondiente al :id enviado como parametro.

    • URL Params id=[string]

    • Data Params:

     content=[string]
     author=[string]
     location=[string]
    • Example:
     {
     	"content": "Introducing new ways to build with GitHub Enterprise 900.12",
     	"author": "5a63bc11d560cc3684ce5122",
     	"location": "Silicon Valley"
     }
  • DELETE api/tweets/:id : Elimina el tweet de la base de datos.

    • URL Params id=[string]

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Api example

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages