Skip to main content
POST
/
v2
/
environments
/
{targetEnvironmentId}
/
diff
PHP
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$diffEnvironmentRequestDto = new Components\DiffEnvironmentRequestDto(
    sourceEnvironmentId: '507f1f77bcf86cd799439011',
);

$response = $sdk->environments->diff(
    targetEnvironmentId: '6615943e7ace93b0540ae377',
    diffEnvironmentRequestDto: $diffEnvironmentRequestDto

);

if ($response->diffEnvironmentResponseDto !== null) {
    // handle response
}
{
  "sourceEnvironmentId": "<string>",
  "targetEnvironmentId": "<string>",
  "resources": [
    {
      "changes": [
        {
          "sourceResource": {
            "id": "<string>",
            "name": "<string>",
            "updatedBy": {
              "_id": "<string>",
              "firstName": "<string>",
              "lastName": "<string>",
              "externalId": "<string>"
            },
            "updatedAt": "2024-01-15T10:30:00.000Z"
          },
          "targetResource": {
            "id": "<string>",
            "name": "<string>",
            "updatedBy": {
              "_id": "<string>",
              "firstName": "<string>",
              "lastName": "<string>",
              "externalId": "<string>"
            },
            "updatedAt": "2024-01-15T10:30:00.000Z"
          },
          "diffs": {
            "previous": {},
            "new": {}
          },
          "stepType": "<string>",
          "previousIndex": 123,
          "newIndex": 123
        }
      ],
      "summary": {
        "added": 123,
        "modified": 123,
        "deleted": 123,
        "unchanged": 123
      },
      "sourceResource": {
        "id": "<string>",
        "name": "<string>",
        "updatedBy": {
          "_id": "<string>",
          "firstName": "<string>",
          "lastName": "<string>",
          "externalId": "<string>"
        },
        "updatedAt": "2024-01-15T10:30:00.000Z"
      },
      "targetResource": {
        "id": "<string>",
        "name": "<string>",
        "updatedBy": {
          "_id": "<string>",
          "firstName": "<string>",
          "lastName": "<string>",
          "externalId": "<string>"
        },
        "updatedAt": "2024-01-15T10:30:00.000Z"
      },
      "dependencies": [
        {
          "resourceId": "<string>",
          "resourceName": "<string>",
          "isBlocking": true
        }
      ]
    }
  ],
  "summary": {
    "totalEntities": 123,
    "totalChanges": 123,
    "hasChanges": true
  }
}

Authorizations

Authorization
string
header
required

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

Headers

idempotency-key
string

A header for idempotency purposes

Path Parameters

targetEnvironmentId
string
required

Target environment ID (MongoDB ObjectId) to compare against

Body

application/json

Diff request configuration

sourceEnvironmentId
string

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

Example:

"507f1f77bcf86cd799439011"

Response

OK

sourceEnvironmentId
string
required

Source environment ID

targetEnvironmentId
string
required

Target environment ID

resources
object[]
required

Diff resources by resource type

summary
object
required

Overall summary