### Sample CloudEvent JSON for topic construction Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Sample CloudEvent used to illustrate how the topic address is constructed from the source and type attributes. The topic is derived as default/org.my.crm/1/ce/org/my/crm/Customer/Added/v1. ```json { "specversion": "1.0", "id": "b9976b88-b446-493a-84eb-432cda902349", "source": "/default/org.my.crm/1", "type": "org.my.crm.Customer.Added/v1", "subject": "customerId:123", "time": "2020-09-17T09:56:24Z", "data": { "customerId": "123" } } ``` -------------------------------- ### Event Mesh Service Instance Parameters (JSON) Source: https://help.sap.com/docs/event-mesh/event-mesh/create-event-mesh-service-instance JSON parameters for creating an Event Mesh service instance with the lite plan. The emname parameter is mandatory and unique for a subaccount. Set management to true to use REST APIs for management, and messagingrest to true to use REST APIs for messaging. ```json { "emname": "", "options": { "management": true, "messagingrest": true } } ``` -------------------------------- ### Create Webhook Subscription Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Creates a webhook subscription to consume CloudEvents over HTTP. The request must include the subscription name, event source/type pairs, and the webhook URL. The service internally creates a queue named /ce/webhook/ and subscribes it to topics derived from the source/type pairs. ```http POST /sap/ems/v1/events/subscriptions Host: https://enterprise-messaging-pubsub.cfapps.eu10.hana.ondemand.com Authorization: Bearer ... Content-Type: application/json { "name": "crm-ext-webhook", "events": [{ "source": "/default/org.my.crm/1", "type": "org.my.crm.Customer.Added.v1" }, { "source": "/default/org.my.crm/1", "type": "org.my.crm.Customer.Deleted.v1" } ], "webhookUrl": "" } ``` -------------------------------- ### Publish Event Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Publishes a CloudEvent to the SAP Event Mesh. The event is routed to a topic constructed from the source and type attributes. Supports structured and binary modes with JSON format for structured mode. QoS and TTL headers can be specified. ```APIDOC ## [POST] /publish ### Description Publishes a CloudEvent to the SAP Event Mesh. The event is routed to a topic constructed from the source and type attributes. Supports structured and binary modes with JSON format for structured mode. QoS and TTL headers can be specified. ### Method POST ### Endpoint /publish ### Parameters #### Headers - **X-QoS** (string) - Optional - Quality of Service: AT_LEAST_ONCE or AT_MOST_ONCE. Default: AT_LEAST_ONCE. - **X-Time-To-Live** (integer) - Optional - Time to live for the message in milliseconds. Default: 2592000000. #### Request Body - **specversion** (string) - Required - CloudEvents specification version, e.g., "1.0". - **id** (string) - Required - Unique event ID. - **source** (string) - Required - Event source (three-segment source without leading slash). - **type** (string) - Required - Event type (dots replaced by slashes in topic). - **subject** (string) - Optional - Event subject. - **time** (string) - Optional - Event timestamp in RFC3339 format. - **data** (object) - Optional - Event data. ### Request Example { "specversion": "1.0", "id": "b9976b88-b446-493a-84eb-432cda902349", "source": "/default/org.my.crm/1", "type": "org.my.crm.Customer.Added/v1", "subject": "customerId:123", "time": "2020-09-17T09:56:24Z", "data": { "customerId": "123" } } ### Response #### Success Response (204) No content. Indicates the event was published (for AT_LEAST_ONCE) or accepted (for AT_MOST_ONCE). #### Response Example (No content) ### Error Handling - **204** - Success (for AT_LEAST_ONCE, indicates published; for AT_MOST_ONCE, indicates accepted). - **Non-204** - For AT_LEAST_ONCE, indicates the event was not published; client should retry. ``` -------------------------------- ### Handshake with Basic Authentication Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Handshake call for a webhook protected with basic authentication. The webhook must respond with a WebHook-Allowed-Origin header matching the request's WebHook-Request-Origin value, or '*'. The handshake is an OPTIONS call. ```http OPTIONS Headers: Authorization: Basic WebHook-Request-Origin: ``` -------------------------------- ### Handshake with OAuth 2.0 Authentication Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Handshake call for a webhook protected with OAuth 2.0 authentication. The webhook must respond with a WebHook-Allowed-Origin header matching the request's WebHook-Request-Origin value, or '*'. The handshake is an OPTIONS call. ```http OPTIONS Headers: Authorization: Bearer WebHook-Request-Origin: ``` -------------------------------- ### Event Delivery Request Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Event delivery request sent by the service to the webhook after a successful handshake. The service sends one event per request in binary mode. The webhook URL is protected with OAuth 2.0 authentication. ```http POST Headers: Authorization: Bearer WebHook-Request-Origin: Content-Type: X-Subscription-Name: //Additional headers for binary mode of events complying to the HTTP binding in CloudEvents specification.// Request Body: ``` -------------------------------- ### OAuth 2.0 Token Request Source: https://help.sap.com/docs/event-mesh/event-mesh/rest-apis-for-events Requests an OAuth 2.0 access token for webhook authentication. The token URL is called with an HTTP POST method and the client credentials are sent as a basic authentication header. ```http POST ?grant_type=client_credentials Headers: Authorization: Basic ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.