Code Embed

Style examples

  1. Filter for posts that include the phrase "web 2.0":

    interaction.content contains "web 2.0"

  2. Filter for a Twitter user description that includes the phrase "social media expert".

    twitter.user.description contains "social media expert"

  3. Filter for posts that include the word "LOUD" in upper case.

    interaction.content cs contains "LOUD"

  4. Filter for posts that include the word "quiet" in lower case.

    interaction.content cs contains "quiet"

  5. Filter for posts that include the word "Polish" but ignore posts that only mention "polish".

    interaction.content cs contains "Polish"

Buttons

Visit Datasift.com

http://dev.datasift.com/docs/platform/api
Icon

API

Complete reference documentation for the API

Alert boxes

tip icon


This is an alert box of type 'tip'. Notice that you can include markdown formatting. Also, you can include links, such as datasift.com.

note icon


This is an alert box of type 'note'. Notice that you can include markdown formatting. Also, you can include links, such as datasift.com.

warning icon


This is an alert box of type 'warning'. Notice that you can include markdown formatting. Also, you can include links, such as datasift.com.

Summary table

What you'll learn: How to record data
Duration: 20 minutes

Table of contents

Tables

Table with formatted content
Name Contents
source_type required

Data source name. A string.

Name required

Custom identifier for the user. A string

Example values: xkcd

Code embedding examples

Shell

pip install datasift v1.3

JSON

{
   "analysis":{
      "analysis_type":"timeSeries",
      "redacted":false,
      "results":[
         {
            "unique_authors":25900,
            "key":1431622800,
            "interactions":32320
         }
      ],
      "parameters":{
         "interval":"hour",
         "span":1
      }
   }
}

Python

# import required library
from datasift import Client

Javascript

alert("Hello world!");

CSDL

// Some comment
tags "asdasdasd"
stream "asdasdasa"
filter "asdasds"

/* Some tags
  tags "asdasdasd"
  stream "asdasdasa"
  filter "asdasds"
  tag.rich.testing "Test tag" { fb.content any "asdasd" }
*/
tag "Test tag" { fb.content any "asdasd" }
tag.rich.testing "Test tag" { fb.content any "asdasd" }
tag.rich.testing "Test tag" { interaction.sample > 50 AND interaction.sample < 0.5324 AND interaction.sample > .6 AND interaction.sample > .92 }

return {
  (
    fb.all.content exists
    AND fb.all.content all "asdasd"
    AND fb.all.content contains_near "asdasd"
    OR NOT fb.all.content in "asdasd, asdasda"
    OR NOT fb.all.content url_in "asdasd, asdasda"

    AND fb.all.content == "asdasd, asdasda"
    AND fb.all.content != "asdasd, asdasda"
    AND fb.all.content > "asdasd, asdasda"
    AND fb.all.content >= "asdasd, asdasda"
    AND fb.all.content < "asdasd, asdasda"
    AND fb.all.content <= "asdasd, asdasda"

    OR fb.all.content [keep(Pc)] "asdas"
    OR fb.all.content [keep("," + "." + "!")] "asdas"
    OR fb.all.content [drop("," + "." + ";")] "asdas"
    OR fb.all.content [keep(default - "'"), drop(default - "'")] "asdas"
  )
}