Coder Social home page Coder Social logo

newswatcher-api's Introduction

#Newswatcher storage api#

##Utility##

Running images without rebuilding (from the root of repository)

bin/start-dev-http.sh

Connect to the docker container

docker exec -it newswatcher-api bash

Update database schema (from the container)

cd /data/http && vendor/bin/doctrine orm:schema-tool:update --force

##Sources## ###Create a twitter source### Query:

POST /sources_twitter HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8
{"method":"user","accessTokenKey":"tokenKey","accessTokenSecret":"tokenSecret"}

Answer:

HTTP/1.1 201 Created
Location: /sources_twitter/1

{
  "id": 1,
  "method": "user",
  "consumerKey": "key",
  "consumerSecret": "secret",
  "accessTokenKey": "tokenKey",
  "accessTokenSecret": "tokenSecret"
}

###Create an article and associate it to an existing source### Query:

POST /sources_twitter/1/articles HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8
{"url":"http://petitchevalroux.net/index.html"}

Answer:

HTTP/1.1 201 Created
Location: /articles/1

{
  "id": 1,
  "url": "http://petitchevalroux.net/index.html",
  "urlHash": "e2bdebe9696bce525305d9cdb277fe10",
  "title": null
}

###Associate an existing source to an existing user ### Query:

POST /sources_twitter/1/users/1 HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8

Answer:

HTTP/1.1 201 Created

{
  "sources_twitter": {
    "id": "1"
  },
  "users": {
    "id": "1"
  }
}

###List source's users ### Query:

GET /sources_twitter/1/users HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8

Answer:

HTTP/1.1 200 OK

[
    {
        "id": 1,
        "name": "petitchevalroux"
    }
]

###Link article to user ### Query:

POST /articles_users HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8
{"user":1,"article":1}

Answer:

HTTP/1.1 200 OK

{
  "article": {
    "id": 1,
    "url": "http://dev.petitchevalroux.net",
    "urlHash": "1403472b2e77a13211ac0c3035952ac2",
    "title": null
  },
  "user": {
    "id": 1,
    "name": "petitchevalroux",
    "twitterId": null,
    "twitterToken": null,
    "twitterTokenSecret": null
  },
  "status": 0
}

###Get user's articles###

Query :

GET /articles_users?filters[user]=1 HTTP/1.1
Host: 192.168.99.100:8081
Content-Type: application/json; charset=UTF-8

Answer :

HTTP/1.1 200 OK
[
    {
        "id": 1,
        "article": {
            "id": 2,
            "url": "http://example.com/",
            "urlHash": "e49e31fb7338f1fa0cf7fd9fb205d453",
            "title": "Example Domain"
        },
        "user": {
            "id": 1,
            "name": "name",
            "twitterId": "id",
            "twitterToken": "token",
            "twitterTokenSecret": "secret"
        },
        "status": 0
    }
]

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.