Applications Service (APPS) Webhooks

The Applications service is responsible for managing applications and technical configurations for Cegid products. This service belongs to the Juice family of services.

Index

Events

Event Description Payload Payload Description Remarks
Aclentries_Created Triggered after an ACL entries is created. ACLEntries The created ACL Entries.
Aclentries_Deleted Triggered after an ACL entries is deleted. ACLEntries The deleted ACL Entries.
Aclentries_Updated Triggered after an ACL entries is updated. ACLEntries The updated ACL Entries.
Appdefinition_Created Triggered after an application definition is created. AppDefinition The created application definition.
Appdefinition_Deleted Triggered after an application definition is deleted. EntityDeletedPayload The deleted application definition.
Appdefinition_Updated Triggered after an application definition is updated. AppDefinitionChanges The original and the current application definition values.
AppDefinitionApiRequiredScopes_Updated Triggered when the required scopes of an AppDefinition are modified. AppDefinitionApiRequiredScopesChanges The original and current required scopes values.
AppDefinitionDependencies_Updated Triggered when the dependencies of an AppDefinition are modified. AppDefinitionDependenciesChanges The original and current dependencies values.
AppDefinitionFeatures_Updated Triggered when the features of an AppDefinition are modified. AppDefinitionFeaturesChanges The original and current features values.
AppDefinitionResources_Updated Triggered when the resources of an AppDefinition are modified. AppDefinitionResourcesChanges The original and current resources values.
AppDefinitionRoles_Updated Triggered when the roles of an AppDefinition are modified. AppDefinitionRolesChanges The original and current roles values.
AppInstance_Activated Triggered after an application instance was activated. AppInstanceStateChangedPayload An entity that identifies the application instance by its key and aditional information about the state change.
AppInstance_Closed Triggered after an application instance was closed. AppInstanceStateChangedPayload An entity that identifies the application instance by its key and aditional information about the state change.
Appinstance_Created Triggered after an application instance is created. AppInstance The created application instance.
Appinstance_Deleted Triggered after an application instance is deleted. EntityDeletedPayload The deleted application instance.
AppInstance_Failed Triggered after an application instance provisioning has failed. AppInstanceStateChangedPayload An entity that identifies the application instance by its key and aditional information about the state change.
AppInstance_Suspended Triggered after an application instance was suspended. AppInstanceStateChangedPayload An entity that identifies the application instance by its key and aditional information about the state change.
Appinstance_Updated Triggered after an application instance is created. AppInstance The updated application instance.
AppInstanceCompany_Created Triggered after an application instance company association is created. AppInstanceCompany The created association data.
AppInstanceCompany_Deleted Triggered after an application instance company association is deleted. AppInstanceCompany The deleted association data.
AppInstanceCompany_Updated Triggered after an application instance company association is updated. AppInstanceCompany The updated association data.
Organization_Created Triggered after an organization is created. Organization The created organization.
Organization_Deleted Triggered after an organization is deleted. EntityDeletedPayload The deleted organization.
Organization_Updated Triggered after an organization is updated. Organization The updated organization.
Rolesassignments_Created Triggered after a roles are created. RolesAssignments The created roles.
Rolesassignments_Deleted Triggered after a roles are deleted. RolesAssignments The deleted roles.
Workspace_Created Triggered after a workspace is created. Workspace The created workspace.
Workspace_Deleted Triggered after a workspace is deleted. EntityDeletedPayload The deleted workspace.
Workspace_Updated Triggered after a workspace is updated. Workspace The updated workspace.

^ Back to top

Payloads

ACLEntries

Describes an acl entries.

Property Description
Entries Gets or sets the ACL entries.

^ Back to top

AppDefinition

Defines an application definition.

Property Description
Resources The collection of application definition resources.
Features The application definition features.
Roles Gets or sets the roles.
Dependencies Gets or sets the dependencies.
DescriptionTranslations Gets or sets the description translations.

^ Back to top

AppDefinitionApiRequiredScopesChanges

Describes an app definition API required scopes changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppDefinitionChanges

Describes an app definition changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppDefinitionDependenciesChanges

Describes an app definition dependencies changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppDefinitionFeaturesChanges

Describes an app definition features changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppDefinitionResourcesChanges

Describes an app definition resources changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppDefinitionRolesChanges

Describes an app definition roles changes.

Property Description
OriginalValues Gets or sets the original values.
CurrentValues Gets or sets the current values.

^ Back to top

AppInstance

Defines an application instance.

Property Description
BaseKey The application instance base key.
SharedKey The application instance shared key.
TrackingId The application instance tracking identifier. Provides full tracking throughout the infrastructure stack.
Description The application instance description.
Name The application instance name.
AppDefinitionKey The key of the application definition associated to the application instance.
Group The application definition group that the application instance belongs to.
WorkspaceKey Gets or sets the workspace key.
OrganizationKey The key of the organization associated with the app instance.
Version The application version used by the application instance.
StartDate The application instance start date.
EndDate The application instance end date.
State The application instance current state.
StateReason The application instance state reason. Contains the metadata associated with the current state.
Resources The application instance resources.
Features The application instance features.
AccessTags The application instance access tags.

^ Back to top

AppInstanceCompany

Describes an app instance company.

Property Description
AssociationKey Gets or sets the association key.
AppInstance Gets or sets the app instance.
Company Gets or sets the company.

^ Back to top

AppInstanceStateChangedPayload

Describes an app instance state changed payload.

Property Description
Key Gets or sets the key.
PreviousState Gets or sets the previous state.
PreviousStateReason Gets or sets the previous state reason.
NewStateReason Gets or sets the new state reason.
ChangedAt Gets or sets the changed at.
WorkspaceKey Gets or sets the workspace key.
OrganizationKey Gets or sets the organization key.
AppDefinitionKey Gets or sets the app definition key.
Group Gets or sets the group.

^ Back to top

EntityDeletedPayload

The payload to send on a entity deleted event.

Property Description
Key The deleted entity key.

^ Back to top

Organization

Defines an organization.

Property Description
BaseKey The organization base key.
TrackingId The organization tracking identifier.
Name The organization name.
WorkspaceKey The key of the workspace associated to the organization.
State The organization current state.
StateReason The organization state reason. Contains the metadata associated with the current state.

^ Back to top

RolesAssignments

Describes a roles assignments.

Property Description
Assignments Gets or sets the assignments.

^ Back to top

Workspace

Defines a workspace.

Property Description
BaseKey The workspace base key.
TrackingId The workspace tracking identifier.
Description The workspaces description.
Name The workspace name.
State The workspace current state.
StateReason The workspace state reason. Contains the metadata associated with the current state.

^ Back to top

Operations

The REST API provides endpoints that allow creating, updating, and deleting subscriptions to specific events.

Create Subscription

Creates a subscription for one or more webhooks events.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application subscribing the webhook. MyApplication
EventNames A list containing the names of the events being subscribed. [Appdefinition_Created]
CallbackUrl The address of the endpoint that should receive the webhook callback. https://server.io/callback
Secret A shared secret, defined by the client application, that can be used to authenticate the callbacks. MySpecialSecret
DeadLettering.Enabled A value indicating whether the subscription should support dead-lettering. false
DeadLettering.Configuration The configuration that should be use for dead-lettering (when enabled). See Dead-lettering
Active A value indicating whether the subscription should be activated. true

Result

The subscription identifier, which can latter be used to update, delete it, etc.

Example (HTTP)

POST /api/v{version:apiVersion}/webhooks
content-type: application/json
body:
{
  "clientId": "{ClientId}",
  "eventNames": [
    "{EventName}
  ],
  "callbackUrl": "{CallbackUrl}",
  "secret": "{Secret}",
  "deadLettering": {
    "enabled": false,
    "configuration": null
  },
  "active": true
}

Example (Client Library)

CreateWebhookSubscriptionRequest request = new CreateWebhookSubscriptionRequest()
{
  (...)
};

try
{
  RestServiceResult<string> result = await this.ServiceClient.Webhooks.CreateSubscriptionAsync(request).ConfigureAwait(false);

  string subscriptionId = result.Value;

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Update Subscription

Updates an existing subscription.

Parameters

Parameter Description Example
SubscriptionId The identifier of the subscription that should be updated.
ClientId The unique identifier of the client application that subscribed the webhook. MyApplication
EventNames A list containing the names of the events being subscribed. [Appdefinition_Created]
CallbackUrl The address of the endpoint that should receive the webhook callback. https://server.io/callback
Secret A shared secret, defined by the client application, that can be used to authenticate the callbacks. MySpecialSecret
DeadLettering.Enabled A value indicating whether the subscription should support dead-lettering. false
DeadLettering.Configuration The configuration that should be use for dead-lettering (when enabled). See Dead-lettering
Active A value indicating whether the subscription should be activated. true

Example (HTTP)

PUT /api/v{version:apiVersion}/webhooks
content-type: application/json
body:
{
  "subscriptionId": "{SubscriptionId}",
  "clientId": "{ClientId}",
  "eventNames": [
    "{EventName}
  ],
  "callbackUrl": "{CallbackUrl}",
  "secret": "{Secret}",
  "deadLettering": {
    "enabled": false,
    "configuration": null
  },
  "active": true
}

Example (Client Library)

UpdateWebhookSubscriptionRequest request = new UpdateWebhookSubscriptionRequest()
{
  (...)
};

try
{
  RestServiceResult result = await this.ServiceClient.Webhooks.UpdateSubscriptionAsync(request).ConfigureAwait(false);

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Delete Subscription

Deletes an existing subscription.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application that subscribed the webhook. MyApplication
SubscriptionId The identifier of the subscription that should be deleted.

Example (HTTP)

DELETE /api/v{version:apiVersion}/webhooks/{clientId}/{subscriptionId}

Example (Client Library)

try
{
  RestServiceResult result = await this.ServiceClient.Webhooks.DeleteSubscriptionAsync("{ClientId}", "{SubscriptionId}").ConfigureAwait(false);

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Get Webhooks Metadata

Retrieves metadata about all the webhooks available.

Result

The webhooks metadata.

[
  {
    "eventName": "{EventName}",
    "eventDescription": "{EventDescription}",
    "PayloadDescription": "{PayloadDescription}"
  }
]

Example (HTTP)

GET /api/v{version:apiVersion}/webhooks

Example (Client Library)

try
{
  RestServiceResult<IList<WebhookMetadata>> result = await this.ServiceClient.Webhooks.GetWebhooksMetadataAsync().ConfigureAwait(false);

  IList<WebhookMetadata> metadata = result.Value;

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Get Subscription

Retrieves a subscription.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application that subscribed the webhook. MyApplication
SubscriptionId The identifier of the subscription that should be retrieved.

Result

The subscription information.

{
  "clientId": "{ClientId}",
  "subscriptionId": "{SubscriptionId}",
  "eventNames": ["{EventName1}", "{EventName2}"],
  "secret": "{Secret}",
  "callbackUrl": "{CallbackUrl}",
  "filters": {
    "{Filter1}": "{Value1}",
    "{Filter2}": "{Value2}"
  },
  "properties": {
    "{Property1}": "{Value1}",
    "{Property2}": "{Value2}"
  },
  "deadLettering": {
    "enabled": true,
    "configuration": "{Configuration}"
  },
  "active": true,
  "modifiedOn": {ModifiedOn},
  "lastRequest": {
    (...)
  },
  "lastResponse": {
    (...)
  }
}

Example (HTTP)

GET /api/v{version:apiVersion}/webhooks/{clientId}/{subscriptionId}

Example (Client Library)

try
{
  RestServiceResult<WebhookSubscription> result = await this.ServiceClient.Webhooks.GetSubscriptionAsync("{ClientId}", "{SubscriptionId}").ConfigureAwait(false);

  WebhookSubscription subscription = result.Value;

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Get Subscriptions

Retrieves all the subscriptions for a given client.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application that subscribed the webhooks. MyApplication

Result

A list containing the subscriptions information (as in Get Subscription).

Example (HTTP)

GET /api/v{version:apiVersion}/webhooks/{clientId}

Example (Client Library)

try
{
  RestServiceResult<IList<WebhookSubscription>> result = await this.ServiceClient.Webhooks.GetSubscriptionsAsync("{ClientId}").ConfigureAwait(false);

  IList<WebhookSubscription> subscriptions = result.Value;

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Delete Subscriptions

Deletes all the subscriptions for a given client.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application that subscribed the webhooks. MyApplication

Example (HTTP)

DELETE /api/v{version:apiVersion}/webhooks/{clientId}

Example (Client Library)

try
{
  RestServiceResult result = await this.ServiceClient.Webhooks.DeleteSubscriptionsAsync("{ClientId}").ConfigureAwait(false);

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Ping Subscription

Pings a subscription.

Parameters

Parameter Description Example
ClientId The unique identifier of the client application that subscribed the webhook. MyApplication
SubscriptionId The identifier of the subscription that should be invoked.

Example (HTTP)

POST /api/v{version:apiVersion}/webhooks/{clientId}/{subscriptionId}/ping

Example (Client Library)

try
{
  RestServiceResult result = await this.ServiceClient.Webhooks.PingSubscriptionAsync("{ClientId}", "{SubscriptionId}").ConfigureAwait(false);

  (...)
}
catch (RestRequestException ex)
{
  (...)
}

^ Back to top

Callbacks

When a webhook event occurs, the callback URL will be invoked for all active subscriptions.

This callback is a request to the endpoint configured in the subscription, including the webhook payload in the content.

Additionally, the following headers will be sent in the request, allowing the client application to identify the concrete event and authenticate the request.

Header Description Example
X-Webhook-Application The identifier of the application sending the callback. APPS
X-Webhook-Event The identifier of the event that triggered the callback. Appdefinition_Created
X-Webhook-Delivery A unique identifier of the callback (it will be the same for all retries). 8f2cad06-73bd-4eb3-98ef-1a78b53506db
X-Webhook-Signature The HMAC SHA256 signature of the payload, computed using the secret provided by the client application when the subscription was created or last updated. sha256=4C3019F69CD9AA11ECF24EF3D9F10AB97CF3B0F0662F1718291615152E2213C3
X-Webhook-Properties The properties specified by the client application when the subscription was created or last updated. These properties can be used by the client application to pass state to the callbacks.

^ Back to top

Dead-lettering

If the webhooks server supports dead-lettering, then it can be enabled when creating or updating webhooks subscriptions.

This feature ensures the availability to the client application of all the events occurred, because, when the server is not able to deliver a webhook (for example, if the client is down), after retrying the configured number of times, it will store the event in the blobs storage account provided by the client configuration. The client can inspect this blob storage and recover all the missed events.

The configuration is provided using the DeadLettering.Configuration setting, when creating/updating a subscription. This should be a config string (a string in the form prop1=value;prop2=value) specifying how the server should connect to the storage account, using the following properties:

Notice that you can either specify the connection using ConnectionString OR ServiceUri, TenantId, ClientId, and ClientSecret.

The values passed in for ConnectionString, ServiceUri, TenantId, ClientId, and ClientSecret need to be escaped, by replacing the following chars:

Each dead-letter will be a JSON file stored in the blob container and named <EventName>-<Timestamp>-<RandomString>.

^ Back to top