Create Campaign API Endpoints
Endpoint
POST /project-type/create
Request Structure
Body Parameters
RequestInfo: Object containing RequestInfo.
CampaignDetails: Object containing the details of the campaign to be created.
tenantId: Tenant identifier.
hierarchyType: Type of hierarchy.
action: Action type (
create
ordraft
).boundaries: Array of boundaries.
resources: Array of resources.
projectType: Type of the project.
deliveryRules: Array of delivery rules.
Additional request info
Response Structure
Success Response
ResponseInfo: Object containing ResponseInfo.
CampaignDetails: The created campaign details.
Flow
Client Initiates Request
The client initiates a createCampaign request to the Project Factory Service.
Validate Request
If the action is 'create':
The Project Factory Service validates the request schema.
It also validates the uniqueness of the campaign name in the database.
If the campaign name exists, an error is thrown.
If the action is 'draft':
The Project Factory Service validates the request schema.
It also validates the uniqueness of the campaign name in the database.
If the campaign name exists, an error is thrown.
Boundary and MDMS Validation
For both 'create' and 'draft' actions:
The Project Factory Service validates the request for hierarchy type and boundaries with the Boundary Service.
It validates the request for the project type code from MDMS.
Create Campaign
If the action is 'create':
The Project Factory Service validates the request for data resources.
It enriches the CampaignDetails and sets the status to 'creating'.
The CampaignDetails are persisted in the database.
For each resource data, the Project Factory Service creates resources through the
/project-factory/v1/data/_create
API.It enriches boundaries for project creation and creates projects for each boundary with the Health Project Service.
The enriched CampaignDetails are persisted in the database.
The CampaignDetails object is sent to a Kafka topic for project mappings.
If the campaign status is not "created", project mappings are performed through the
/project-factory/v1/project-type/createCampaign
API and the status is updated to 'created'.If the campaign status is already 'created', an error is thrown, and the status is updated to 'failed'.
If the action is 'draft':
The CampaignDetails are enriched, and the status is set to 'drafted'.
The enriched CampaignDetails are persisted in the database.
Response
The Project Factory Service sends the response back to the client.
Flow Diagram

Last updated
Was this helpful?