Campaigns
POST /establishment/[establishmentId]/campaigns
Creates a new campaign for a given establishment.
Endpoint
Request Body
{
"details": "object"
"targeting": "object"
"prizes": "object"
}
Atributo | Tipo |
---|---|
details | object |
targeting | object |
prizes | object |
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
Responses
201
Campaign created successfully.
{
"message": "string"
"campaignId": "string"
}
400
Bad request - Invalid payload.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
500
Internal server error.
GET /establishment/[establishmentId]/campaigns
Returns a list of campaigns associated with the specified establishment.
Endpoint
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
Responses
200
List of campaigns retrieved successfully.
400
Bad request - Invalid establishment ID.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
500
Internal server error.
GET /establishment/[establishmentId]/campaigns/[campaignId]
Returns the details of a specific campaign associated with the given establishment.
Endpoint
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
200
Campaign retrieved successfully.
{
"campaignId": "string"
"details": "object"
"targeting": "object"
"prizes": "object"
}
400
Bad request - Invalid establishment or campaign ID.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
DELETE /establishment/[establishmentId]/campaigns/[campaignId]
Deletes a campaign associated with the given establishment.
Endpoint
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
204
Campaign deleted successfully.
400
Bad request - Invalid establishment or campaign ID.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
PUT /establishment/[establishmentId]/campaigns/[campaignId]
Updates the details of a campaign associated with the given establishment.
Endpoint
Request Body
{
"details": "object"
"targeting": "object"
"prizes": "object"
}
Atributo | Tipo |
---|---|
details | object |
targeting | object |
prizes | object |
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
200
Campaign updated successfully.
{
"message": "string"
"campaignId": "string"
}
400
Bad request - Invalid input or campaign data.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
GET /establishment/[establishmentId]/campaigns/[campaignId]/simulate
Simulates the campaign execution to determine how many users would be affected based on the current campaign conditions.
Endpoint
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
200
Simulation results returned successfully.
400
Bad request - Invalid establishment or campaign ID.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
GET /establishment/[establishmentId]/campaigns/[campaignId]/execute
Executes the campaign and returns the list of affected users and selected winners.
Endpoint
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
200
Campaign executed successfully.
{
"affected_users": "120"
"winners": "[object Object],[object Object]"
}
400
Bad request - Invalid establishment or campaign ID.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
POST /establishment/[establishmentId]/campaigns/[campaignId]/simulate-realtime
Simulates the campaign execution with dynamic conditions and returns the list of affected users and potential winners.
Endpoint
Request Body
{
"conditions": "array"
"startDate": "string"
"endDate": "string"
}
Atributo | Tipo |
---|---|
conditions | array |
startDate | string |
endDate | string |
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
campaignId | The unique identifier of the campaign. | string |
Responses
200
Real-time simulation executed successfully.
{
"affected_users": "150"
"winners": "[object Object],[object Object]"
}
400
Bad request - Invalid input data.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
404
Campaign not found.
500
Internal server error.
POST /establishments/[establishmentId]/campaigns/insert-activity
Inserts data into the ClickHouse database for either player registrations or campaign activities.
Endpoint
Request Body
{
"mode": "string"
"data": "object"
}
Atributo | Tipo |
---|---|
mode | string |
data | object |
Parameters
Atributo | Descripcion | Tipo |
---|---|---|
establishmentId | The unique identifier of the establishment. | string |
Responses
200
Data inserted successfully.
{
"message": "Record inserted into campaign_registers successfully."
}
400
Bad request - Invalid input.
401
Unauthorized - Invalid authentication token.
403
Forbidden - Insufficient permissions.
500
Internal server error.