Notifications
Notification API Documentation
Overview
The notification mechanism in our API is a crucial component for tracking the progress and outcomes of Image Generation Tasks. Notifications are essential for receiving feedback on task statuses and ensuring seamless communication between the API and client applications.
Why Notifications Are Important
inNotification channels are vital because they provide feedback on the results of image generation tasks. Before using the API, at least one notification channel must be configured from the available types (webhook or RabbitMQ). Among these, webhook is recommended, as it aligns with our internal solutions.
Without an active notification channel, a client application cannot initiate any image generation requests and will encounter the following error:
Notification Channel Features
When defining notification channels, it is optional to include the generated image data in the notification message content. Alternatively, the notification can simply provide task completion updates.
Important: If the parameter
includeImageData
is set totrue
, the generated image data will be included in the notification message content. Otherwise, the notification will provide only task completion updates without including the image data.
A client application can define multiple notification channels of different types (webhook, RabbitMQ).
Task Notifications
The API sends two types of notifications:
An "Image Generation Task Completed" message when an individual task is finished.
An "Image Generation Progress" message when all tasks are completed.
Creating, Updating, and Managing Notifications
Using the provided endpoints, a client application can:
Create notification channels
Update notification channels
Delete notification channels
List all or active notification channels defined for the client application
Authentication Requirements
Each request made by a client application to the API must include:
A valid JWT token
x-api-key
andx-api-secret
values defined by AdCreative and provided to the client application. These values also carry information about the API usage credits.
If these authentication values are missing, the following error will be returned:
This section provides a foundational understanding of how the notification mechanism operates and the prerequisites for its effective use. The next section will detail the available endpoints, including their request and response structures.
Notification Query Endpoints
1. Get All Notification Channel Configurations
Endpoint
GET /api/v1/Notification/ChannelConfiguration/All
Description
Retrieves a list of all notification channel configurations associated with a specific application.
Request
Query Parameters
applicationId
(required): The unique identifier of the application.
Example Request
Example Response
2. Get Active Notification Channel Configurations
Endpoint
GET /api/v1/Notification/ChannelConfiguration/Active
Description
Retrieves a list of active notification channel configurations for a specific application.
Request
Query Parameters
applicationId
(required): The unique identifier of the application.
Example Request
Example Response (Active Notification Found)
Example Response (No Active Notification Found)
3. Get Specific Notification Channel Configuration
Endpoint
GET /api/v1/Notification/ChannelConfiguration
Description
Retrieves a specific notification channel configuration by its configuration ID.
Request
Query Parameters
applicationId
(required): The unique identifier of the application.configurationId
(required): The unique identifier of the configuration.
Example Request
Example Response
4. Delete Notification Channel Configuration
Endpoint
DELETE /api/v1/Notification/ChannelConfiguration
Description
Deletes a specific notification channel configuration by its configuration ID.
Request
Query Parameters
applicationId
(required): The unique identifier of the application.configurationId
(required): The unique identifier of the configuration.
Example Request
Example Response
This section provides detailed documentation for the RabbitMQ and WebHook notification configuration endpoints. These endpoints allow client applications to configure notification channels for receiving task completion updates.
RabbitMQ Endpoints
POST /api/v1/Notification/ChannelConfiguration/RabbitMQ
Description Creates a new RabbitMQ notification channel configuration for a specified application.
Request
URL:
/api/v1/Notification/ChannelConfiguration/RabbitMQ
Query Parameters:
Headers:
Body (form-data):
Example Response
PUT /api/v1/Notification/ChannelConfiguration/RabbitMQ
Description Updates an existing RabbitMQ notification channel configuration.
Request
URL:
/api/v1/Notification/ChannelConfiguration/RabbitMQ
Query Parameters:
Headers:
Body (form-data):
Example Response
WebHook Endpoints
POST /api/v1/Notification/ChannelConfiguration/WebHook
Description Creates a new WebHook notification channel configuration for a specified application.
Request
URL:
/api/v1/Notification/ChannelConfiguration/WebHook
Query Parameters:
Headers:
Body (form-data):
Example Response
Notes: All API requests must include valid JWT tokens in the header, along with
x-api-key
andx-api-secret
values.
Enum Values in ResponsesIn the responses, the
NotificationChannel
property represents the type of notification channel used. This property corresponds to the following enum values:
WebHook
0
Webhook channel
SignalR
1
SignalR channel
RabbitMQ
2
RabbitMQ channel
Please use these mappings to interpret the
NotificationChannel
values in the API responses.
Last updated