Skip to content

Instantly share code, notes, and snippets.

@mthurman
Created October 16, 2012 01:35
Show Gist options
  • Save mthurman/3896795 to your computer and use it in GitHub Desktop.
Save mthurman/3896795 to your computer and use it in GitHub Desktop.
App.net streaming code samples
$ curl https://alpha.app.net/oauth/access_token -d 'client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&grant_type=client_credentials'
{"access_token": "[APP_ACCESS_TOKEN]"}
$ curl https://alpha-api.app.net/stream/0/streams -H 'Authorization: Bearer [APP_ACCESS_TOKEN]' -H 'Content-Type: application/json' -d '{"object_types": ["post"], "type": "long_poll", "key": "testing_stream"}'
{..."endpoint_url": "[ENDPOINT_URL]"}
$ curl [ENDPOINT_URL]
$ curl https://alpha-api.app.net/stream/0/filters -H 'Authorization: Bearer [USER_ACCESS_TOKEN]' -H 'Content-Type: application/json' -d '{"match_policy": "include_any", "clauses": [{"object_type": "post", "operator": "matches", "value": "blog.app.net", "field": "/data/entities/links/*/url"}], "name": "Posts related to the App.net blog"}'
{..."id": "[FILTER_ID]"...}
$ curl https://alpha-api.app.net/stream/0/streams -H 'Authorization: Bearer [APP_ACCESS_TOKEN]' -H 'Content-Type: application/json' -d '{"object_types": ["post"], "type": "long_poll", "key": "testing_filtered_stream", "filter_id": "[FILTER_ID]"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment