Difference between revisions of "AddEventBatch"

From Gvp-public
Jump to navigation Jump to search
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Api_Method_Spec|
 
{{Api_Method_Spec|
Description=
+
Description=The AddEventBatch is a method to add massive events in just one request, in another words, send multiply events as [[AddEvent]] in the same time. On mobile device, for example, in a offline mode, all events that wants to add can be storage in a pool, and when it become online, send all data in one request to the AddEventBatch.
 +
 
 +
The principal difference between [[AddEvent]], is that the parameter eventData is an Array of [[AnalyticsEventItem]] that contains each event to add with his info like timestamp and event title.
 +
 
 +
The AddEventBatch can be used logged or anonymous.
 +
 
 +
For each event, if not specified the context parameter, the user data will be obtained from the Token.
 +
 
 +
For more information about the behavior, see [[AddEvent]] method.
 +
 
 +
 
 +
The following parameters are always overwritten by GVP
 +
 
 +
* USERID -> (From token)
 +
* DEVICEID -> (From token, deviceID in case it is a loginTrustedDevice, User IP if loginUserPAssword)
 +
* DEVICETYPEID (From token)
 +
* IPADDRESS (From request heades)
 +
* INSTANCEID -> (From token)
 +
* LANGUAGEID -> (From token)
 +
* SESSIONID -> (From token: currently empty because some device couldnt support it)
 +
* CONTEXT ->  (From token: always true)
 +
 
 +
 
 +
Avoid also using any parameter Starting By MIB* (It returns an error in the method)
 +
 
 +
examples
 +
* MIBAPPLICATIONAME
 +
* MIBTIMESTAMP
 +
* MIBEVENTNAME
  
  
Line 14: Line 42:
 
|ParamType=[[AnalyticsEventItem]]
 
|ParamType=[[AnalyticsEventItem]]
 
|ParamRequired=required
 
|ParamRequired=required
|ParamDescription=The eventData parameter is an [[AnalyticsEvenItem]] object type and represent a set of data to register the event in the Mongo data base.
+
|ParamDescription=The eventData parameter is an [[AnalyticsEventItem]] object type and represent a set of data to register the event in the Mongo data base. Each event has the Timestamp, Event and an object with many pair of key:value. It allow to add any pair key:value as you need because it will be add in the Mongo database dynamically inserting a new column by each new key added.
 
: e.g.  
 
: e.g.  
 
:: {
 
:: {
:::  "Timestamp" : "4315435114",
+
:::  Token: "",
:::  "Event" : "Navigation",
+
:::  mediaInfo: "",
:::  "Data" :
+
:::  eventData: [
::::    [
+
::::  {
:::::     {"ChannelListed": "channel_name1", "ProductId": "123" }
+
:::::  "Timestamp" : "1578910731",
:::::     {"PageViewed": "page_name1", "ProductId": "123" }
+
:::::  "Event" : "EventName",
:::::     {"ButtonClicked": "button_name1", "ProductId": "123" }
+
:::::  "Data" :
:::::    {"ButtonClicked": "button_name2", "ProductId": "123" }
+
:::::::    {
:::::     {"PageViewed": "page_name2", "ProductId": "456" }
+
::::::::      "EventType":"STOP",
::::     ]
+
::::::::      "ChannelNumber":1,
 +
::::::::      "ChannelName":"TVE 1",
 +
::::::::      "ChannelCallLetter":"",
 +
::::::::      "StreamQuality":"SD",
 +
::::::::      "UniqueUserCode":null,
 +
::::::::      "DeviceId":"3333333333332222222222227128",
 +
::::::::      "OBInstanceCode":25,
 +
::::::::      "UserType":null,
 +
::::::::      '''"Context":false,'''
 +
:::::::    }
 +
::::  },
 +
::::   {
 +
:::::  "Timestamp" : "1578910737",
 +
:::::  "Event" : "AnotherEventName",
 +
:::::  "Data" :
 +
:::::::    {
 +
::::::::      "EventType":"Rent",
 +
::::::::      "ActionType":"Click",
 +
::::::::      "ProductType":1,
 +
::::::::      "DeviceId":"3333333333332222222222227128",
 +
::::::::       "OBInstanceCode":29,
 +
::::::::      "Advertising":null
 +
::::::::      "MerchantId":123,
 +
::::::::      '''"Context":true,'''
 +
:::::::    }
 +
::::   }
 +
:::  ]
 
:: }
 
:: }
 
}}
 
}}
Line 33: Line 87:
 
|ParamType=String
 
|ParamType=String
 
|ParamRequired=optional
 
|ParamRequired=optional
|ParamDescription=This parameter can be found in the [[GetMediaURL]] and has all information about the Movie. Is passed, it will be used to assign the eventData with the movie.
+
|ParamDescription=This parameter can be found in the [[GetMediaUrl]] and has all information about the Movie. Is passed, it will be used to assign the eventData with the movie.
 
: e.g.
 
: e.g.
 
:: "MediaInfo": "eyJNb3ZpZUlkIjozNTkzNiwiTWVkaWFJZCI6 … XlsaXN0SWQiOjAsIk1lZGlhVHlwZSI6MSwiRHVyYXRpb24iOjU4MjB9"
 
:: "MediaInfo": "eyJNb3ZpZUlkIjozNTkzNiwiTWVkaWFJZCI6 … XlsaXN0SWQiOjAsIk1lZGlhVHlwZSI6MSwiRHVyYXRpb24iOjU4MjB9"
Line 52: Line 106:
  
 
|Exceptions=
 
|Exceptions=
None
+
* [[InvalidEventDataException]]
  
 
|Cache=
 
|Cache=
Line 84: Line 138:
 
* [[AddEvent]]
 
* [[AddEvent]]
 
* [[GetMediaUrl]]
 
* [[GetMediaUrl]]
 +
* [[AnalyticsEventItem]]
 
}}
 
}}

Latest revision as of 10:19, 13 January 2020

Description

The AddEventBatch is a method to add massive events in just one request, in another words, send multiply events as AddEvent in the same time. On mobile device, for example, in a offline mode, all events that wants to add can be storage in a pool, and when it become online, send all data in one request to the AddEventBatch.

The principal difference between AddEvent, is that the parameter eventData is an Array of AnalyticsEventItem that contains each event to add with his info like timestamp and event title.

The AddEventBatch can be used logged or anonymous.

For each event, if not specified the context parameter, the user data will be obtained from the Token.

For more information about the behavior, see AddEvent method.


The following parameters are always overwritten by GVP

  • USERID -> (From token)
  • DEVICEID -> (From token, deviceID in case it is a loginTrustedDevice, User IP if loginUserPAssword)
  • DEVICETYPEID (From token)
  • IPADDRESS (From request heades)
  • INSTANCEID -> (From token)
  • LANGUAGEID -> (From token)
  • SESSIONID -> (From token: currently empty because some device couldnt support it)
  • CONTEXT -> (From token: always true)


Avoid also using any parameter Starting By MIB* (It returns an error in the method)

examples

  • MIBAPPLICATIONAME
  • MIBTIMESTAMP
  • MIBEVENTNAME

Parameters

  • token (String, required)
A valid token for identifying the API session context. The token can be anonymous or logged.
The eventData parameter is an AnalyticsEventItem object type and represent a set of data to register the event in the Mongo data base. Each event has the Timestamp, Event and an object with many pair of key:value. It allow to add any pair key:value as you need because it will be add in the Mongo database dynamically inserting a new column by each new key added.
e.g.
{
Token: "",
mediaInfo: "",
eventData: [
{
"Timestamp" : "1578910731",
"Event" : "EventName",
"Data" :
{
"EventType":"STOP",
"ChannelNumber":1,
"ChannelName":"TVE 1",
"ChannelCallLetter":"",
"StreamQuality":"SD",
"UniqueUserCode":null,
"DeviceId":"3333333333332222222222227128",
"OBInstanceCode":25,
"UserType":null,
"Context":false,
}
},
{
"Timestamp" : "1578910737",
"Event" : "AnotherEventName",
"Data" :
{
"EventType":"Rent",
"ActionType":"Click",
"ProductType":1,
"DeviceId":"3333333333332222222222227128",
"OBInstanceCode":29,
"Advertising":null
"MerchantId":123,
"Context":true,
}
}
]
}
  • mediaInfo (String, optional)
This parameter can be found in the GetMediaUrl and has all information about the Movie. Is passed, it will be used to assign the eventData with the movie.
e.g.
"MediaInfo": "eyJNb3ZpZUlkIjozNTkzNiwiTWVkaWFJZCI6 … XlsaXN0SWQiOjAsIk1lZGlhVHlwZSI6MSwiRHVyYXRpb24iOjU4MjB9"


Returns

Returns a JSON object containing the information if the event is registered on server.

Example:

{

"StatusCode": 0,
"Severity": 1,
"StatusMessage": "OK",
"Content": true

}


Exceptions


Caching

This method is not cached.


Known issues

None


Version history

API Version Number Change description Changes author
1.0 Initial method design Harley Cabral
2.4 Ricardo Calvo



See also