1.0.0 • Published 9 years ago

fleck-api v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Fleck-API

Interface for the Fleck API.

You must have an API token in order to use it. For getting one, send an email to api@getfleck.com.

How To Install:

The generated code relies on node package manager (npm) being available to resolve dependencies. Once published you can install the library by issuing the following command.

npm install fleck-api

How To Use:

The following example shows how to use the API:

// import the module
var fleck = require('fleck-api');

// set the client API token
// if you don't have one, send an email to api@getfleck.com
fleck.apiToken = 'DF2BohjGgXJSU9A_hQrZmQPpQlLOiiTi';

// customize the request. For more info check out the options table
// in the reference section
var options = {
    size: fleck.Size.s1242,
    language: fleck.Language.ru,
    secure: fleck.Secure.yes
};

// make the request
fleck.getRelease(options,function(error, response){
    // handle error
    if (error) {
        console.log('error:',error);
        return;
    }

    // do something with the info
    var release = response.release;
    var posts = response.posts;

    options.before = release.timestamp;

    fleck.getRelease(options,function(error, response){
        // handle error
        if (error) {
            console.log('error:',error);
            return;
        }

        // do something with the info
        var release = response.release;
        var posts = response.posts;

        console.log("Release:", release);
        console.log("Posts:", posts);
    });
});

Reference:

Table of options and its valid values. In the models folder there are enums for the options to ensure valid values.

ParamDescriptionValid valuesDefault
beforeIt will return the release with a date strictly less than the number.Integers greater than 1419084000, which is the timestamp of the first release (20th december 2015). Any previous timestamp will return a 204 HTTP Response.current timestamp
versionThe version of the API.1.01.0
languageThe topic name and location name are localizeden,es,ru,pt_PT,pt_BR,de,fren
sizeSize of the image212,250,414,640,750,1242640
secureIf true, all links use httpsyes,noNo

####Response:

The response is parsed by the library. The following is a JSON response example:

// curl "https://api.getfleck.com/release?token=validtoken&v=1.0"
{
  "posts" :
  [
        // omitted other 19 elements
        {
          "created": 1433895797,
          "creator": {
              "avatar_url": "http://media.getfleck.com/avatars/I5dNCBwABkeK3PQX.jpg",
              "name": "Tiffany Sherwood"
          },
          "img_url": "http://media.getfleck.com/640x640/JEAuPFQABvYWNP9H.jpg",
          "location": {
              "lat": 40.7127837,
              "lon": -74.0059413,
              "name": "New York, United States"
          },
          "order": 1433955580,
          "position": 20,
          "release": {
              "number": 173,
              "timestamp": 1433955600
          },
          "topic": {
              "name": "Street Art"
          },
          "web_url": "http://getfleck.com/s/JEAuPFQABvYWNP9H"
      }
  ],
  "release": {
      "number": 173,
      "timestamp": 1433955600
  }
}

Post object

VariableTypeDescription
createdFloatTimestamp of submission with seconds precision.
creatorCreatorUser info
img_urlStringUrl of the post image with the size requested
locationLocationLocation of the post.
orderIntegerPosition of the post related to all post of Fleck. Useful to compare post from different releases to determine the absolute order
positionIntegerPosition of the post inside the release. It starts at 1.
releaseReleaseRelease that the post belongs to.
topicTopicTopic that the post belongs to.
web_urlStringURL of the web version of the post.

Release object

VariableTypeDescription
numberIntegerUnique release number. Starts at 1.
timestampFloatTimestamp with seconds precision at the time the release was published.

Topic object

VariableTypeDescription
nameStringLocalized name of the topic

Location object

As of Fleck 2.1 users can optionally attach a location to a post. Currently, locations are all cities and not any more specific (all posts in the same city have the same lat/lon). If the post doesn't have a location, the response will be a location object with every property with a null value.

VariableTypeDescription
nameStringLocalized name of the place
latFloatLatitude of the place
lonFloatLongitude of the place

Creator object

VariableTypeDescription
avatar_urlStringURL of the avatar with a size 200x200 px
nameStringUser's name