Configuration

The Configuration object contains variables which define the current behavior of the App.net platform.

Example Configuration object

{
  "text": {
    "uri_template_length": {
      "post_id": 9,
      "message_id": 12
    }
  },
  "user": {
    "annotation_max_bytes": 8192,
    "text_max_length": 256
  },
  "file": {
    "annotation_max_bytes": 8192
  },
  "post": {
    "annotation_max_bytes": 8192,
    "text_max_length": 256
  },
  "message": {
    "annotation_max_bytes": 8192,
    "text_max_length": 2048
  },
  "channel": {
    "annotation_max_bytes": 8192
  }
}

Configuration fields

Field Type Description
text object Configuration that is common to all text fields (post.text, message.text, user.description.text).
Field Type Description
uri_template_length object A mapping from each of the possible URI template replacement values to the number of characters that are "used" upon replacement.
user Resource Configuration Object The configuration related to User objects.
file Resource Configuration Object The configuration related to File objects.
post Resource Configuration Object The configuration related to Post objects.
message Resource Configuration Object The configuration related to Message objects.
channel Resource Configuration Object The configuration related to Channel objects.

Resource Configuration

{
  "annotation_max_bytes": 8192,
  "text_max_length": 256
}

A Resource Configuration object represents values that only apply to a specific App.net resource.

Resource Configuration Fields

Field Type Description
annotation_max_bytes integer The maximum number of bytes that can be attached to this type of object as an Annotation.
text_max_length integer The maximum number of characters that an instance of this object can be. For User objects, this applies to the User description. This field does not apply to Channel objects.

How to use the Configuration object

The App.net platform has platform-wide limits that all apps must respect. These limits are enforced at an API level, but can be useful to have defined as constants in your app’s code, often for the purpose of displaying your user interface. Examples are things like: “how long can a Post be” or “how long can annotations be on a Channel object.” This endpoint allows you to update your app’s configuration so it always has the newest platform-wide configuration values available.

We recommend:

  1. Ship your application with a static copy of the configuration object. When your app launches for the first time, persist those static values into your application’s preference store (NSUserDefaults or SharedPreferences, etc.)
  2. On launch, and at most once per day, poll the configuration endpoint; if it differs from the previously persisted data, update your persisted copy of the configuration object.
  3. Always use the values from your persisted configuration.

This pattern will ensure that no matter whether your application has network connectivity or not, you will have values, even if they are out of date. As the majority of these variables are related to user interface, slightly outdated configuration variables are generally not a problem.

This endpoint should be queried with an access token if you have one. If you are creating an app which supports multiple user accounts, you may store this data globally instead of per-user.

Retrieve the Configuration object

Returns the current Configuration object.

Your application should request this endpoint with a user or app access token if available.

Endpoint

Method URL Token
GET https://api.app.net/config None

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/config"
{
  "data": {
    "text": {
      "uri_template_length": {
        "post_id": 9,
        "message_id": 12
      }
    },
    "user": {
      "annotation_max_bytes": 8192,
      "text_max_length": 256
    },
    "file": {
      "annotation_max_bytes": 8192
    },
    "post": {
      "annotation_max_bytes": 8192,
      "text_max_length": 256
    },
    "message": {
      "annotation_max_bytes": 8192,
      "text_max_length": 2048
    },
    "channel": {
      "annotation_max_bytes": 8192
    }
  },
  "meta": {
    "code": 200
  }
}