Giter Club home page Giter Club logo

linkdot_api's Introduction

API Documentation

This documentation intends to give an overview of the Apis endpoints and the appropriate way to consume them using any client.

Getting started with linkdot_api

Prerequisites

You are going to need:

  • Linux or OSX
  • Ruby version-2.4.0
  • Rails version-5.0
  • Bundler - If Ruby is installed but the budnle command does not work, just run gem install bundler in a terminal.

Getting Set Up

  1. Fork this repository on Github.
  2. Clone the forked repository to your hard drive using git clone [email protected]:YOUR USERNAME/linkdot_api.git
  3. cd linkdot_api
bundle install
rake db:create
rake db:migrate
rails s

You can now see the apis up and running locally at http://localhost:3000. Whoa! Thats fast ;)

Endpoints

We target to develop Api's for the following features in our project. Of course, we will be adding more as we move along with the scope of the project.

  • Sign Up:

    This end point creates new user.

    HTTP Request

    POST http://localhost:3000/users/sign_up

    Request Parameters

    Parameter Presence Description
    user[emai] required User email address.
    user[password] required User password.
    picture[avatar] required Picture of the user.
    tag_ids[0] required Array of tag ids, that represent user interest.

    Curl Request

    curl -X POST -F "user[email]='[email protected]" -F "user[password]=12345678" -F "tag_ids[0][]=1" -F" picture[avatar]=@Path of local image" http://localhost:3000/users/sign_up

    The above command returns a json response like this:


  {
    "user": {
        "id": 51,
        "email": "[email protected]",
        "picture": {
            "id": 47,
            "image": "http://localhost:3000/system/pictures/avatars/000/000/047/original/pin.jpg?1503499504"
        },
        "tags": [
            {
                "name": "Digital Programming"
            },
            {
                "name": "Digital Programming"
            },
            {
                "name": "Meta Programming"
            }
        ]
    }
 }

  • Sign In:

    This end point signs in new user.

    HTTP Request

    POST http://localhost:3000/users/sign_in

    Request Perameters

    Parameter Presence Description
    user[email] required User email address.
    user[password] required User Password

    Curl Request

    curl -X POST -F "user[email]='[email protected]" -F "user[password]=12345678" http://localhost:3000/users/sign_in

    The above command returns a response like this:

      {
        "user": {
            "id": 55,
            "email": "[email protected]",
            "authentication_token": "xBysg6BptdYxZi2WPWsk",
            "picture": {
                "id": 51,
                "image": "http://localhost:3000/system/pictures/avatars/000/000/051/original/ns.jpg?1503684916"
            },
            "tags": [
                {
                    "name": "Digital Programming"
                }
            ]
                }
      }
    
    
  • Sign Out:

    This endpoint sign out login user.

    HTTP Request

    DELETE http://localhost:3000/users/sign_out

    Request Parameters

    Parameter Presence Description
    token required Sing in user's token.
    user[email] required User email address.
    user[password] optional User password.
    user[first_name] optional User first name.
    user[last_name] optional User last name.
    picture[avatar] optional Picture of the user.
    tag_ids[0] optional Array of tag ids, that represent user interest.

    Curl Request

    curl -X DELETE -H "Authorization: Token token=TOKEN OF SIGN IN USER" http://localhost:3000/users/update

    The above command returns a response like this.

    {"detail":"Sign Out Successfully."}
    
    
  • Update User:

    This endpoint updates user's attributes.

    HTTP Request

    PUT http://localhost:3000/users/update

    Request Parameters

    Parameter Presence Description
    token required Sign in user's token.
    user[email] required Sign in user's email
    user[password] optional Sign in user's password
    user[password_confirmation] optional Sign in user's password confirmation
    picture[avatar] optional Sign in user's picture.
    user[first_name] optional Sign in user's first name.
    user[last_name] optional Sign in user's last name.
    tag_ids[] optional Array of tag ids, that represent user interest. Tags that are passed to this api will be removed from user's interest.

    Curl Request

    curl -X PUT -H "Authorization: Token token=TOKEN OF SIGN IN USER" -F "user[email]=email" -F "user[first_name]=f_name" http://localhost:3000/users/update

    The above command returns a response like this.

      {
        "user": {
            "id": 1,
            "email": "[email protected]",
            "first_name": "Jesse",
            "last_name": "Wright",
            "authentication_token": "z971Maay1KdibLRStBBB",
            "picture": {
                "id": 75,
                "image": "http://localhost:3000/system/pictures/avatars/000/000/051/original/ns.jpg?1503684916"
            },
            "tags": []
        }
      }
    
    
  • Events:

    Get all events

    This endpoint returns all events in the system.

    HTTP Request

    GET http://localhost:3000/events

    Request Parameters

    Parameter Presence Description
    token required Auth token of sign in user

    Curl Request

    curl -H "Authorization: Token token=TOKEN OF SIGN IN USER" http://localhost:3000/events

    The above command returns a json response like this:

      {
      "events": [
          {
              "id": 7,
              "title": "Smart City Innovation",
              "address": "Alto University Finland",
              "city": "Helsenki",
              "state": "HL",
              "zip": "38100",
              "event_start_time": "02:00 AM",
              "event_end_time": "12:00 PM",
              "event_start_date": "09-12-2017",
              "event_end_date": "12-12-2017",
              "picture": {
                  "id": 45,
                  "image": "http://localhost:3000/system/pictures/avatars/000/000/045/original/19467565_717135315143212_2254025401790960972_o.jpg?1503409105"
              },
              "tags": [
                  {
                      "name": "Digital Programming"
                  },
                  {
                      "name": "Digital Programming"
                  },
                  {
                      "name": "Meta Programming"
                  }
              ]
          },
          {
              "id": 8,
              "title": "Trip to Ericson Lab",
              "address": "Ericson Labs.Inc",
              "city": "Helsenki",
              "state": "HL",
              "zip": "38100",
              "event_start_time": "02:00 AM",
              "event_end_time": "12:00 PM",
              "event_start_date": "09-12-2017",
              "event_end_date": "12-12-2017",
              "picture": {
                  "id": 46,
                  "image": "http://localhost:3000/system/pictures/avatars/000/000/046/original/calculatoe1955.jpg?1503410065"
              },
              "tags": [
                  {
                      "name": "Digital Programming"
                  },
                  {
                      "name": "Digital Programming"
                  },
                  {
                      "name": "Meta Programming"
                  }
              ]
          }
      ]
    }
    

linkdot_api's People

Contributors

mhassaan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.