Creating a Post via the API

This guide assumes you have an access token. If you don't have one, check out our guide on creating an app.

A Post is the microblogging primitive of the App.net API. When a user creates a post, it appears in all of their follower’s streams. Posts can have images, links, and annotations but at their simplest, they just contain a piece of text.

Create a post

The easiest way to create a post is to use one of the API libraries.

Using adnpy

import adnpy

# Set the default access token for API calls.
adnpy.api.add_authorization_token('<YOUR ACCESS TOKEN>')

# Create a post
post = adnpy.api.create_post(data={'text':'Hello App.net from Python!'})

Or with the adn Ruby gem:

require 'adn'

ADN.token = '<YOUR ACCESS TOKEN>'
post = ADN::Post.send_post(:text => "Hello App.net from Ruby!")

If you want to send the equivalent broadcast from the API without using a library, use this curl command:

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 "{
  \"text\": \"Hello App.net from curl!\"
}" \
    "https://alpha-api.app.net/stream/0/posts"