Giter Site home page Giter Site logo

api-for-tweetclone's Introduction

Tweetclone API

Intro

I'm now applying my current knowledge with PHP, in this API, build with Lumen Framework.

Objective

This project will be the backend for my another project, an simple app that mimetizes Twitter (will be pushed soon).

How this works?

Works like any other API accepts: GET, POST, DELETE and UPDATE methods

Commands

First things first

Registering into API

Request

You will need to send via POST method: email, pass and nome to register

{
    URL : ''**www.myapp.com/users/register**'',
    Method : ''POST'',
    Headers : new Headers{
        email : ''**your email**'',
        pass : ''**your password**'',
        name : ''**your nickname**''
    }
}

Response

If success

{
    Status : Registered,
    Token : 9abf9cd286df39c9687d26fc95d75a61
}

If something go wrong

{
    Status : ERROR,
    ERROR : Some explanation here about the error
}

Login

Request

Get yout token using GET method, admin and pass Headers, like this:

{
    URL : ''**www.myapp.com/token**'',
    Method : ''GET'',
    Headers : new Headers{
        admin : ''**your email**'',
        pass : ''**your password**''
    }
}

Response

This will return your Token (in JSON) to access the functionalities of API

    {
        token : 9abf9cd286df39c9687d26fc95d75a61
    }
Important!

Send your token in a header of all others Requests

{
    URL : ''**www.myapp.com/anyrequest**'',
    Method : ''GET'',
    Headers : {
        Api-Token : 9abf9cd286df39c9687d26fc95d75a61,
        otherheader : any other data,
        otherheader2 : any other data2
    }
}

Using the API functionality

Following Users

Request

Send this request with PUT method with your Api-Token in header

{
    URL : ''**www.myapp.com/API/users/follow/{user name}'',
    Method : ''PUT'',
    Headers : {
        Api-Token : 9abf9cd286df39c9687d26fc95d75a61
    }
}
Response

If everything was done right you will get this

{
    Status : Success
}

Unfollowing Users

Request

Send this request with DELETE method with your Api-Token in header

{
    URL : ''**www.myapp.com/API/users/unfollow/{user name}'',
    Method : ''DELETE'',
    Headers : {
        Api-Token : 9abf9cd286df39c9687d26fc95d75a61
    }
}
Response

If everything was done right you will get this

{
    Status : Success
}

api-for-tweetclone's People

Contributors

ca10san 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.