Omnisense API Documentation

Base URL : https://app_identifier.app.omnisense.io

Replace "app_identifier" with your unique application identifier.

User data tracking

User profile

This API is used to track all informations about the user himfself.

API : /api/v1/subscriber
Method : POST
Content-Type: application/json
Params :
api_key : String (Mandatory), provided by Omnisense
user : Hash (Optional if udid param is provided), allowed parameters are defined below.
udid : String (Optional if user hash is provided), must be IDFA (iOS) or Google Play ID (Android)
lang : String
platform : String (Optional), when provided, must be one of « android », « iphone »
token : String (Optional), push token (from GCM or APNS).
location : Hash (Optional, must contain latitude/longitude in degrees)
metadata : Hash (Optional), Set of key/values

Allowed parameters for user :

email : String
fb_id : String
first_name : String
last_name : String
birthday : Date
phone : String
address : String
city : String
postal_code : String
country : String, must be the iso code for country (ISO 3166) 
lang : String, must be the iso code for lang (ISO 639)
sex : One of « male », « female »

Example :

{ "api_key" : "1234567890abcdef09876543210",
  "udid": "12345-abcdef-67890-fedcba", 
  "user": {
    "email": "foo@bar.com",
    "first_name": "Foo",
    "last_name": "Bar",
    "lang": "fr"
  },
  "location": {
    "latitude":"42.6932879",
    "longitude":"2.8951097"
  },
  "metadata": {
    "purchase_count": "5"
  }
}

User events recording

This API is used to track user's action such as product view or purchase.

API : /api/v1/user_event
Method : POST
Content-Type: application/json
Params :
api_key : String (Mandatory), provided by Omnisense
email: String, mandatory if udid is not provided
udid: String, mandatory if email is not provided, must be IDFA (iOS) or Google Play ID (Android)
platform: String, mandatory if udid is provided, must be one of "android", "iphone"
user_event: Hash, defined below

Allowed parameters for user_event

identifier: String, name of the event (ex: product.view)
segments: Set of key/values.

Example :

{ "api_key" : "1234567890abcdef09876543210",
  "email": "foo@bar.com",
  "udid": "12345-abcdef-67890-fedcba",
  "user_event": {
    "identifier": "product.view",
    "segments" : {
      "id": "1234",
        "name": "foo",
        "media": "iphone_app"
    }
  }
}

User Event batch create

This API is used to massively import data.

API : /api/v1/user_event/import
Method : POST
Content-Type: application/json
Params :
master_key : String (Mandatory), provided by Omnisense
user_events: Array of user events to create, see below for allowed parameters

Allowed parameters for user_events array

identifier:  String, name of the event (ex: product.view).
segments: Hash, Set of key/values.
email: String, mandatory if udid is not provided
udid: String, mandatory if email is not provided, must be IDFA (iOS) or Google Play ID (Android)
platform: String, mandatory if udid is provided, must be one of "android", "iphone"

Example :

{
  "master_key" : "1234567890abcdef09876543210",
  "user_events" : [
    "email": "foo@bar.com",
      "identifier": "product.view",
      "segments" : {
        "id": "1234",
          "name": "foo",
          "media": "iphone_app"
      }
  ]
}

User Event batch update

This API is used to massively update data based on an identifier. Typically, this identifier is the ID of the object you want to update.

API : /api/v1/user_event
Method : PUT
Content-Type: application/json
Params :
master_key : String (Mandatory), provided by Omnisense
user_events: Array of user events to update, see below for allowed parameters

Allowed parameters for user_events array

update_key : String, The key which will be used to identify the rows to update
object_identifier: String, The object to update
identifier: (optional) String, name of the event (ex: product.view). If none is provided, all events are taken into account.
segments: Hash, Set of key/values to add or update.

Note 1 : All keys not included inside the "segments" hash but already present in the dabatase won't be deleted, whereas new keys will be added.

Note 2 : Update are done in background and may take several minutes.

Example :

{ 
  "master_key" : "1234567890abcdef09876543210",
  "user_events" : [
     {
        "update_key": "id",
        "object_identifier": "1234",
        "segments" : {
           "name": "bar"
        }
     },
     {
        "update_key": "region",
        "object_identifier": "Languedoc-Roussillon",
        "segments" : {
           "region": "Occitanie",
           "foo" : "bar"
        }
     }
  ]
}