Zum Hauptinhalt springen

AddCampaignConstraint

RPC Configuration

Rpc Name:

Plain: AddCampaignConstraint
Sha1: 9ba17ac2afadcf01c7e155cc3b35cbabc60eab7f
Rpc Call

RPCs can be called by their plain name or their SHA1 representation.

Rpc Parameters:

"building_id" : int,
"campaign_id" : int,
"constraint_type" : string,
"constraint_config" : mixed,
"proximity" : float = 2.5
Parameter Description


@param string campaign_type One of the Types ['proximity', 'area', 'time']


@param int proximity Will be ignored for all campaign_types but proximity.

In the following are the different Constraint Types explained: Area:

{
"polygon": [
{
"lat": 49.4987505998679,
"lng": 8.468761816620828
},
{
"lat": 49.498707920852134,
"lng": 8.468733653426172
},
{
"lat": 49.49866829030414,
"lng": 8.468899279832842
},
{
"lat": 49.49874058336755,
"lng": 8.468873128294947
},
"floor": 2
]
}

Proximity: Integer of the Beacon-ID and proximity has to be configured Time:

{
"time": iso8601 Time,
"trigger": iso8601 Time for the Notification Moment,
"repeat": One of ['hour', 'day', 'week'] or null,
"activeHours": [8, 10, 14, 16] or null,
"activeWeekdays": [1, 3, 5] or null,
"activeMonths": [3, 7, 11] or null,
"activeYears": [2023, 2027] or null,
"radius": float in Meter
}

Example Config

{
"time": "10:30:00+02:00",
"trigger": "10:15:00+02:00",
"repeat": "hour",
"activeHours": [8, 10, 14, 16],
"activeWeekdays": null,
"activeMonths": null,
"activeYears": null,
"radius": "5000"
}

So this campaign should trigger at these times:

  • 2020-01-01 10:15 very first trigger
  • 2020-01-01 14:15 second ever trigger
  • 2020-01-01 16:15
  • 2020-01-02 08:15 first trigger on second day and not on these (and more):
  • 2020-01-01 08:15 before StartTime
  • 2020-01-01 11:15 not an active hour
  • 2020-01-01 12:15 also not an active hour

Requires Login:

true

Requires Context:

Context

The context providing parameter can either be a contagt-id (8-Bytes, Alphaumeric) or an integer as a building id. The context parameter name should make the choice obviouse, the type has not to be defined manually.

true

Requires contextParamName:

building_id

Requires WriteAccess:

WriteAccess

Only accounts that have an explicit write access to the defined context can execute this RPC, no matter if the authentication level matches or not.

true

Requires AuthenticationLevel:

Context

Authentication levels allow the SuperUser to define a by-RPC granular access configuration. If RPCs are chained in a single unified call and lenient is enabled, all allowed RPCs will be executed, while execution will fail entirely with lenient set to false.

LOCAL_ADMINISTRATOR

Requires Subbuilding Merge Strategy:

SUBBUILDING_ONLY

Cache Configuration

Response Cache

All writing RPCs are not Cacheable, also Caching will be disabled by the paramters nocache and readonly.

Cache enabled:

false

Sample Request

->

{
"building_id": 1,
"campaign_id": "151",
"constraint_config": {
"polygon": [
{
"lat": 49.4987505998679,
"lng": 8.468761816620828
},
{
"lat": 49.498707920852134,
"lng": 8.468733653426172
},
{
"lat": 49.49866829030414,
"lng": 8.468899279832842
},
{
"lat": 49.49874058336755,
"lng": 8.468873128294947
}
],
"floor": 2
},
"constraint_type": "area"
}

<-

[
{
"id": 1,
"type": "AREA",
"config": {
"polygon": [
{
"lat": 49.4987505998679,
"lng": 8.468761816620828
},
{
"lat": 49.498707920852134,
"lng": 8.468733653426172
},
{
"lat": 49.49866829030414,
"lng": 8.468899279832842
},
{
"lat": 49.49874058336755,
"lng": 8.468873128294947
}
],
"floor": 2
},
"ap_id": null,
"date_start": "2025-01-21 09:13:12",
"date_end": null
}
]