• iOS
  • Android
  • Windows
  • Web
  • Cordova
  • Unity
  • Adobe Air
  • Dashboard
  • API
  • Guides
  • FAQ
  • API > App Data API

    GET - List

    The App Data API enables you to create, update, delete and list data you associated to your application. App Data lets you create tables of key/value pairs. It is for application centric data as opposed to user centric data. You can use the data in your targeting queries and/or in a message template.

    Request structure

    Route

    The App Data API exposes a GET endpoint that lets you list App Data tables:

    https://api.batch.com/1.0/BATCH_API_KEY/app-data

    Here is a valid cURL example:

    curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X GET "https://api.batch.com/1.0/BATCH_API_KEY/app-data"

    The BATCH_API_KEY value is either your Live or Dev Batch API key from the settings page of your app within the dashboard (⚙ Settings → General).

    Headers

    In order to authenticate with the API, you need to provide your company REST API Key as the value of the X-Authorization header.

    Get parameters

    Id Description
    from Integer - Optional, Default : 0
    Value used for pagination : it indicates the offset of the first table to be returned. Tables are sorted by creation date (from the most recent to the oldest).
    E.g."/app-data?from=10"
    limit Integer - Optional, Default : 10, Max : 100
    Value that indicates the maximum number of tables to be returned per API call.
    E.g."/app-data?limit=20"

    Here is an example of a valid cURL command which would return 5 tables, starting from the 10th table (sorted by creation date in descending order):

    curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X GET
    "https://api.batch.com/1.0/BATCH_API_KEY/app-data?from=10&limit=5"

    Responses

    Success

    If the GET to the API endpoint is successful you will receive an HTTP 200 confirmation and information about your audiences.

    {
        "app_data": [
            {
                "name": "your_table_name",
                "description": "The table description",
                "nb_rows": 135, // the number of keys
                "size": 40500, // the size in bytes
                "created": "2018-06-29T14:59:03",
                "updated": "2018-12-29T15:07:32"
            },
            {
                "name": "another_table",
                "description": "The table description",
                "nb_rows": 268,
                "size": 80800, // the size in bytes
                "created": "2018-06-29T13:12:09",
                "updated": "2018-06-29T13:42:59"
            }
        ]
    }

    Failure

    If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at support@batch.com if you need further support.

    • AUTHENTICATION_INVALID (Http status code: 401, Error code: 10)
    • ROUTE_NOT_FOUND (Http status code: 404, Error code: 20)
    • MISSING_PARAMETER (Http status code: 400, Error code: 30)
    • MALFORMED_PARAMETER (Http status code: 400, Error code: 31)
    • MALFORMED_JSON_BODY (Http status code: 400, Error code: 32)
    • SERVER_ERROR (Http status code: 500, Error code: 1)
    • MAINTENANCE_ERROR (Http status code: 503, Error code: 2)