Oted / gsi-backend

Backend for messapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Messapp-backend api

#####Good to know :

{
    "item_types"                : ["youtube", "img", "gif", "gifv", "soundcloud", "vimeo", "vine", "text", "video", "instagram", "sound", "other"],
    "example_addjective_types"  : ["arty", "funny", "inspiring", "creepy", "beautiful", "cute", "crazy", "offensive", "boring", "uggly", "disturbing"]
}

###- [GET api/items] #####Get items from the database sorted on their _sort time

{
    "query": {
        "amount" : "optional, defaults to 20, max(99)",
        "last" : "optional, get items with a sort time greater",
        "first" : "optional, get items with a sort time less than",
        "types" : "optional, array of types to get"
    },
    "response": [{
        "_hash": "c0e7ec652aedac7b8b79d9555a77ada3",
        "_sort": "1420465320873",
        "title": "Tornadoes: Some people just don't give a shit.",
        "type": "gif",
        "data": "i.imgur.com/mdsO8zd.gif",
        "score": -7
    }]
}

###- [POST api/items] #####Post a new item to the server, use only type if you are sure of it!

{
    "params": {
        "data" : "required, usually the link of an item",
        "title" : "preferred but not required, the title of the item",
        "type" : "optional, the type of the item, see the lib/dbWrapper for the types available",
        "scraped" : "optional, true or false"
    }
}

###- [GET api/item] #####Get an item together with its ratings

{
    "query": {
        "hash" : "required, the _hash of the item"
    },
    "response": {
        "item" : {
            "_hash": "c0e7ec652aedac7b8b79d9555a77ada3",
            "_sort": "1420465320873",
            "title": "Tornadoes: Some people just don't give a shit.",
            "type": "gif",
            "data": "i.imgur.com/mdsO8zd.gif",
            "score": -7
        },
        "ratings" : [{
            "lastUpdated": "2015-01-05T14:55:42.100Z",
            "created": "2015-01-05T14:55:42.100Z",
            "_hash": "c0e7ec652aedac7b8b79d9555a77ada3",
            "value": -1,
            "expression": "creepy"
        }]
    }
}

###- [GET api/ratings] #####Get all ratings for a specific items _hash

{
    "query": {
        "hash" : "required, the _hash of the item"
    },
    "response": [{
        "lastUpdated": "2015-01-05T14:55:42.100Z",
        "created": "2015-01-05T14:55:42.100Z",
        "_hash": "c0e7ec652aedac7b8b79d9555a77ada3",
        "value": -1,
        "expression": "creepy"
    }]
}

###- [GET api/bestratings] #####Get all ratings for a specific items _hash

{
    "query": {
        "amount" : "optional, the best rated items hash, max amount is 25 and default to 5",
        "types" : "optional, array of types to get"
    },
    "response": [{
        "_hash": "c0e7ec652aedac7b8b79d9555a77ada3"
    }]
}

###- [POST api/upvote/{hash}] #####Create a new rating with a +1 value, addjective is optional

{
    "params": {
        "hash" : "required, the _hash of the item"
    },
    "query" : {
        "addjective" : "optional, the addjective of the item, should be one of the queried in GET api/addjectives"
    }
}

###- [POST api/novote/{hash}] #####Create a new rating with a 0 value, addjective is optional

{
    "params": {
        "hash" : "required, the _hash of the item"
    },
    "query" : {
        "addjective" : "optional, the addjective of the item, should be one of the queried in GET api/addjectives"
    }
}

###- [POST api/downvote/{hash}] #####Create a new rating with a -1 value, addjective is optional

{
    "params": {
        "hash" : "required, the _hash of the item"
    },
    "query" : {
        "addjective" : "optional, the addjective of the item, should be one of the queried in GET api/addjectives"
    }
}

###- [GET api/addjectives] #####Get an object of equally many shuffeld positive as nagative addjectives that can be used when voting

{
    "query" : {
        "amount" : "optional, amount of positives and negatives"
    },
    "ex.result" : {
        "positives": [
            "inspiring",
            "beautiful",
            "creative"
        ],
        "negatives": [
            "boring",
            "disturbing",
            "annoying"
        ]
    }
}

###- [GET api/info] #####Get an object with information about contents

{
    "query" : {},
    "ex.result" :{
        "types": [
            "youtube",
            "img",
            "other"
        ],
        "adjectives": {
            "positives": [
                "creative",
                "fascinating"
            ],
            "negatives": [
                "boring",
                "confusing"
            ]
        },
        "counts": [
            {
                "_id": "img",
                "count": 3247
            },
            {
                "_id": "youtube",
                "count": 1662
            }
       ]
    } 
}

About

Backend for messapp


Languages

Language:JavaScript 100.0%