Filter Lifecycle

Create a Filter

Create a Filter for the current user.

Send a JSON document that matches the Filter schema with an HTTP header of Content-Type: application/json. Currently, the only keys we use from your JSON will be name, match_policy and clauses.

Endpoint

Method URL Token
POST https://api.app.net/filters User

Data

A JSON object representing the Filter to create.

Example

to see more complete examples.

curl -X POST -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    -H "Content-Type: application/json" -d "{
  \"clauses\": [
    {
      \"field\": \"/data/entities/hashtags/*/name\",
      \"object_type\": \"post\",
      \"operator\": \"matches\",
      \"value\": \"rollout\"
    }
  ],
  \"match_policy\": \"include_any\",
  \"name\": \"Posts about rollouts\"
}" \
    "https://api.app.net/filters"
{
  "data": {
    "clauses": [
      {
        "field": "/data/entities/hashtags/*/name",
        "object_type": "post",
        "operator": "matches",
        "value": "rollout"
      }
    ],
    "id": "1",
    "match_policy": "include_any",
    "name": "Posts about rollouts",
    "owner": "...user object..."
  },
  "meta": {
    "code": 200
  }
}

Retrieve a Filter

Returns a specific Filter object.

Endpoint

Method URL Token
GET https://api.app.net/filters/{filter_id} User

URL Parameters

Name Description
filter_id The id of the Filter to retrieve.

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/filters/1"
{
  "data": {
    "clauses": [
      {
        "field": "/data/entities/hashtags/*/name",
        "object_type": "post",
        "operator": "matches",
        "value": "rollout"
      }
    ],
    "id": "1",
    "match_policy": "include_any",
    "name": "Posts about rollouts",
    "owner": "...user object..."
  },
  "meta": {
    "code": 200
  }
}

Get current user’s Filters

Return the Filter for the current user.

Endpoint

Method URL Token
GET https://api.app.net/filters User

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/filters"
{
  "data": [
    {
      "clauses": [
        {
          "field": "/data/entities/hashtags/*/name",
          "object_type": "post",
          "operator": "matches",
          "value": "rollout"
        }
      ],
      "id": "1",
      "match_policy": "include_any",
      "name": "Posts about rollouts",
      "owner": "...user object..."
    }
  ],
  "meta": {
    "code": 200
  }
}

Update a Filter

Updates a specific Filter object. When a filter is updated, all the streams using the filter will start using the new filter criteria. You can update a filter by PUTing an object that matches the Filter schema with an HTTP header of Content-Type: application/json. The entire filter will be replaced with new value but it’s id will remain the same. Please refer to the documentation on how to create a Filter for more information.

Endpoint

Method URL Token
PUT https://api.app.net/filters/{filter_id} User

URL Parameters

Name Description
filter_id The id of the Filter to update.

Example

to see more complete examples.

curl -X PUT -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    -H "Content-Type: application/json" -d "{
  \"match_policy\": \"include_any\",
  \"clauses\": [
    {
      \"operator\": \"matches\",
      \"field\": \"/data/entities/hashtags/*/name\",
      \"object_type\": \"post\",
      \"value\": \"rollout\"
    },
    {
      \"operator\": \"matches\",
      \"field\": \"/data/entities/hashtags/*/name\",
      \"object_type\": \"post\",
      \"value\": \"bug\"
    }
  ],
  \"name\": \"Posts about rollouts or bugs\"
}" \
    "https://api.app.net/filters/1"
{
  "data": {
    "clauses": [
      {
        "operator": "matches",
        "field": "/data/entities/hashtags/*/name",
        "object_type": "post",
        "value": "rollout"
      },
      {
        "operator": "matches",
        "field": "/data/entities/hashtags/*/name",
        "object_type": "post",
        "value": "bug"
      }
    ],
    "id": "1",
    "match_policy": "include_any",
    "name": "Posts about rollouts or bugs",
    "owner": "...user object..."
  },
  "meta": {
    "code": 200
  }
}

Delete a Filter

Delete a Filter. The Filter must belong to the current User. It returns the deleted Filter on success.

Remember, access tokens can not be passed in a HTTP body for DELETE requests. Please refer to the authentication documentation.

Endpoint

Method URL Token
DELETE https://api.app.net/filters/{filter_id} User

URL Parameters

Name Description
filter_id The id of the Filter to delete.

Example

to see more complete examples.

curl -X DELETE -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/filters/1"
{
  "data": {
    "clauses": [
      {
        "field": "/data/entities/hashtags/*/name",
        "object_type": "post",
        "operator": "matches",
        "value": "rollout"
      }
    ],
    "id": "1",
    "match_policy": "include_any",
    "name": "Posts about rollouts",
    "owner": "...user object..."
  },
  "meta": {
    "code": 200
  }
}

Delete all of the current user’s Filters

Delete all Filters for the current user. It returns the deleted Filters on success.

Remember, access tokens can not be passed in a HTTP body for DELETE requests. Please refer to the authentication documentation.

Endpoint

Method URL Token
DELETE https://api.app.net/filters User

Example

to see more complete examples.

curl -X DELETE -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/filters"
{
  "data": [
    {
      "clauses": [
        {
          "field": "/data/entities/hashtags/*/name",
          "object_type": "post",
          "operator": "matches",
          "value": "rollout"
        }
      ],
      "id": "1",
      "match_policy": "include_any",
      "name": "Posts about rollouts",
      "owner": "...user object..."
    }
  ],
  "meta": {
    "code": 200
  }
}