HP Anywhere API Reference
Event Body

Body fields

These are the fields in the POST event JSON body.

Property name

Description

id

(at top level)

The ID of the event. To avoid duplicate system posts on the same event, the App needs to provide new ID on each event.

Value: string

contextObjects

List of contextObject objects that the event is relevant to.

If no activity is found that includes this list of contextObjects IDs, a new activity is created and these contextObjects are added to the activity.

Context object (also refered as BtoContextObject) is metadata that is saved to the activity by the App. It enables the App to provide recommendations and make various business logic decisions.

objectId

Unique ID of the contextObject.

Value: string

dataType

An identifier of the object type to support App business logic decisions.

 Value: string

displayName

The contextObject display name displayed in the HP Anywhere UI.

Value: string

metadata

(optional property)

Any string data that is saved by the App as additional parameters.

Value: string

app

App object that represents the App that created the contextObject.

id

(In app element)

The serviceId of the App.

message

The event message to send. This message is added as a system post to the Activities timeline and email for the relevant users. This is also the message that is sent to the users' mobile devices by the push notification service.

users

List of users related to this event. They are added to the activity as participants and receive notification according to the isNotify value and their user settings.

id

The unique ID of the user as it appears in the user repository

isNotify (optional property)

Mark the users to be notified by email and push notification.

When this property is not provided, the default value is true.

Value: true or false

Visibility

(optional property)

The privacy setting for new activity flow.  (A new activity is created when the event context object ID is not found in any activity.)

When the visibility is set to PUBLIC, the activity is visible to any user in the user repository via search.

When the visibility is set to PRIVATE, the activity is visible only to the participants in the activity. In this case, the users defined in the event users list.

If the visibility property is not provided, the new activity is created according to the HP Anywhere default admin setting.

 Value: PRIVATE or PUBLIC

notificationType

(optional property)

The Event can send notifications to different channels: front page, email, or push notification. The App can define different notification types in the Admin setting XML file that describe the relevant channels to notify for the specific notification type.

The notificationType value is the key in the admin settings.

If notificationType property is not provided, the default value is to send notification to front page only. (This is defined according to the HP Anywhere admin setting, that can be changed by the administrator via the admin UI).

 Value: String

subject

The subject of the new activity. Applies only to new activity .

Example Request Body

{ "id": "eventId15",
   "contextObjects":
   [
    {
         "objectId": "135893211785089",
         "dataType": "NOTE",
         "displayName": "context1",
         "metaData": "app metadata string",
                    //metadata is optional field, no default
         "app": {
             "id": "NOTES"
         }
      }
   ],
   "message": "Alert message: This note is rejected!",
   "users":
   [
      { "id": "admin",
        "isNotify": "false" //isNotify is optional field, default is true },
      { "id": "user_3@hp.com",
        "isNotify": "true" }
   ],
   "visibility": "PRIVATE", //visibility is optional field, default is system default visibility setting
   "notificationType": "notification.type.reject.note", //notificationType is optional field, default is system general notification type
   "subject": "greatNewSubject" //this subject is used upon create of new activity
}

JSON example explaination

In this example, an event with ID eventId15 is sent to the HP Anywhere server.

The server searches for activities that include a context object with ID 135893211785089.

If the server does not find an activity with that ID, a new activity is created.

The activity's subject is greatNewSubject. admin and user_3@hp.com are added as participants in the activity. The activity has one post created by the system: "Alert message: This note is rejected"

The contextObject as defined in the JSON is added to the activity,

The visibility of the activity is private, which means that only admin and user_3@hp.com can access this activity.

Both admin and user_3@hp.com receive notifications to their HP Anywhere front page.

Only user_3@hp.com receives notifications to his Email and Mobile device (push notification).