Publish resources to target environment

Publishes all workflows and resources from the source environment to the target environment. Optionally specify specific resources to publish or use dryRun mode to preview changes.

POST
/v2/environments/{targetEnvironmentId}/publish

Authorization

Authorization<token>

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

In: header

Request Body

application/jsonRequired

Publish request configuration

sourceEnvironmentIdstring

Source environment ID to sync from. Defaults to the Development environment if not provided.

dryRunboolean

Perform a dry run without making actual changes

Default: false
resourcesarray<object>

Array of specific resources to publish. If not provided, all resources will be published.

Path Parameters

targetEnvironmentIdRequiredstring

Target environment ID (MongoDB ObjectId) to publish resources to

Header Parameters

idempotency-keystring

A header for idempotency purposes

Response Body

OK

resultsRequiredarray<object>

Sync results by resource type

summaryRequiredobject

Summary of the sync operation

export interface Response {
  /**
   * Sync results by resource type
   */
  results: SyncResultDto[];
  /**
   * Summary of the sync operation
   */
  summary: PublishSummaryDto;
}
export interface SyncResultDto {
  /**
   * Type of the layout
   */
  resourceType: "REGULAR" | "ECHO" | "BRIDGE";
  /**
   * Successfully synced resources
   */
  successful: SyncedWorkflowDto[];
  /**
   * Failed resource syncs
   */
  failed: FailedWorkflowDto[];
  /**
   * Skipped resources
   */
  skipped: SkippedWorkflowDto[];
  /**
   * Total number of resources processed
   */
  totalProcessed: number;
}
export interface SyncedWorkflowDto {
  /**
   * Type of the layout
   */
  resourceType: "REGULAR" | "ECHO" | "BRIDGE";
  /**
   * Resource ID
   */
  resourceId: string;
  /**
   * Resource name
   */
  resourceName: string;
  /**
   * Sync action performed
   */
  action: "created" | "updated" | "skipped" | "deleted";
}
export interface FailedWorkflowDto {
  /**
   * Type of the layout
   */
  resourceType: "REGULAR" | "ECHO" | "BRIDGE";
  /**
   * Resource ID
   */
  resourceId: string;
  /**
   * Resource name
   */
  resourceName: string;
  /**
   * Error message
   */
  error: string;
  /**
   * Error stack trace
   */
  stack?: string;
}
export interface SkippedWorkflowDto {
  /**
   * Type of the layout
   */
  resourceType: "REGULAR" | "ECHO" | "BRIDGE";
  /**
   * Resource ID
   */
  resourceId: string;
  /**
   * Resource name
   */
  resourceName: string;
  /**
   * Reason for skipping
   */
  reason: string;
}
export interface PublishSummaryDto {
  /**
   * Number of resources processed
   */
  resources: number;
  /**
   * Number of successful syncs
   */
  successful: number;
  /**
   * Number of failed syncs
   */
  failed: number;
  /**
   * Number of skipped resources
   */
  skipped: number;
}
 
curl -X POST "https://api.novu.co/v2/environments/6615943e7ace93b0540ae377/publish" \
  -H "idempotency-key: string" \
  -H "Authorization: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceEnvironmentId": "507f1f77bcf86cd799439011",
    "dryRun": false,
    "resources": [
      {
        "resourceType": "REGULAR",
        "resourceId": "workflow-id-1"
      }
    ]
  }'
{
  "results": [
    {
      "resourceType": "REGULAR",
      "successful": [
        {
          "resourceType": "REGULAR",
          "resourceId": "string",
          "resourceName": "string",
          "action": "created"
        }
      ],
      "failed": [
        {
          "resourceType": "REGULAR",
          "resourceId": "string",
          "resourceName": "string",
          "error": "string",
          "stack": "string"
        }
      ],
      "skipped": [
        {
          "resourceType": "REGULAR",
          "resourceId": "string",
          "resourceName": "string",
          "reason": "string"
        }
      ],
      "totalProcessed": 0
    }
  ],
  "summary": {
    "resources": 0,
    "successful": 0,
    "failed": 0,
    "skipped": 0
  }
}

On this page

No Headings
Edit this page on GitHub