### Example HTTP Request to Start Mambu Event Stream Source: https://api.mambu.com/streaming-api An example HTTP/1.1 GET request to initiate an event stream for a specific subscription ID, including query parameters for stream control and required headers like Accept, apikey, and X-Flow-Id. ```HTTP GET https://TENANT_NAME.mambu.com/api/v1/subscriptions/0691160a-b519-4595-b85c-a400fc73e96/events?stream_limit=10&stream_timeout=600 HTTP/1.1 Accept: application/json apikey: string X-Flow-Id: string ``` -------------------------------- ### API Documentation for Start Event Stream Endpoint Source: https://api.mambu.com/streaming-api Comprehensive API documentation for the `GET /subscriptions/{subscription_id}/events` endpoint, detailing its purpose, client rebalancing considerations, possible HTTP responses, response headers, and all supported request parameters (header, query, and path). ```APIDOC GET /subscriptions/{subscription_id}/events Description: This endpoint starts a new stream for reading events from this subscription. The data will be automatically rebalanced between streams of one subscription. - The minimal consumption unit is a partition, so it is possible to start as many streams as the total number of partitions in event-types of this subscription. - The rebalance currently only operates with the number of partitions so the amount of data in event-- types/partitions is not considered during autorebalance. - The position of the consumption is managed by Mambu. The client is required to commit the cursors it gets in a stream. Client Rebalancing: - If you need more than one client for your subscription to distribute load or increase throughput - you can read the subscription with multiple clients and Mambu will automatically balance the load across them. - Currently, the maximum number of supported clients per subscription is equal to the number of event types in the subscription multiplied by `3`. - For example if there are two event types in the subscription, the total number of clients for the subscription is `6`. The total of all the partitions within a subscription cannot be more than `100`. This gives a maximum of `33` event types per subscription. - Recommendation: to improve throughput, maintain the same number of partitions and consumer clients from the start. This ensures a balanced distribution of the workload, minimises delays and simplifies rebalancing. - The API provides a guarantee of at-least-once delivery, this means that there are cases where duplicate events may be sent if there are errors committing events - a useful technique to detect and handle duplicates is to be idempotent and to check the `eid` field of event metadata. Responses: 200 OK: Subscription for such parameters already exists. Returns subscription object that already existed. Schema: Subscription 201 Created: Subscription was successfuly created. Returns subscription object that was created. Schema: Subscription 400 Bad Request: Bad Request. Schema: Problem 422 Unprocessable Entity: Unprocessable Entity. Schema: Problem Response Headers: 200 Location: string (uri) - The relative URI for this subscription resource. 201 Location: string (uri) - The relative URI for the created resource. 201 Content-Location: string (uri) - If the `Content-Location` header is present and the same as the `Location` header the client can assume it has an up to date representation of the Subscription and a corresponding `GET` request is not needed. Parameters: X-Flow-Id: string (header) - The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis. max_uncommitted_events: string (query) - The maximum number of uncommitted events that Mambu will stream before pausing the stream. When in paused state and commit comes - the stream will resume. batch_limit: integer (query) - Maximum number of `event`s in each chunk (and therefore per partition) of the stream. stream_limit: integer (query) - Maximum number of `event`s in this stream (over all partitions being streamed in this connection). batch_flush_timeout: integer (query) - Maximum time in seconds to wait for the flushing of each chunk (per partition). stream_timeout: integer (query) - Maximum time in seconds a stream will live before connection is closed by the server. stream_keep_alive_limit: integer (query) - Maximum number of empty keep alive batches to get in a row before closing the connection. commit_timeout: string (query) - Maximum amount of seconds that Mambu will be waiting for commit after sending a batch to a client. apikey (required): string (header) - your API key subscription_id (required): string(uuid) (path) - Id of subscription. ``` -------------------------------- ### Retrieve Mambu Function Details with GET Request Source: https://api.mambu.com/mambu-functions-api Provides code examples in various programming languages demonstrating how to make a GET request to the Mambu Functions API to retrieve the details of a specific function by its name. The request includes the necessary 'Accept' header for API versioning. ```bash # You can also use wget curl -X GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName} \ -H 'Accept: application/vnd.mambu.v2+json' ``` ```HTTP GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName} HTTP/1.1 Host: tenant ``` -------------------------------- ### Example JSON for Cursor Schema Source: https://api.mambu.com/streaming-api Provides a JSON example for the 'Cursor' schema, illustrating the structure for specifying an offset and partition ID for event streams. ```JSON { "offset": "001-0001-000000000000000000", "partition": "1" } ``` -------------------------------- ### Example API Responses for Get Mambu Function Subscription Source: https://api.mambu.com/mambu-functions-api Illustrative JSON responses for successful (HTTP 200) and rate-limited (HTTP 429) requests when retrieving a Mambu Function Subscription. ```json { "name": "all_savings_withdrawal", "state": "ACTIVE", "batchSize": 50, "batchWindow": 3, "event": "SAVINGS_WITHDRAWAL" } ``` ```json { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### Get Mambu Function Subscription using various programming languages Source: https://api.mambu.com/mambu-functions-api Code examples demonstrating how to retrieve the details of a specific Mambu Function Subscription using cURL, HTTP, JavaScript, Ruby, Python, PHP, Java, and Go. ```curl curl -X GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName} \ -H 'Accept: application/vnd.mambu.v2+json' ``` ```HTTP GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName} HTTP/1.1 Host: tenant_name.mambu.com Accept: application/vnd.mambu.v2+json ``` ```javascript const headers = { 'Accept':'application/vnd.mambu.v2+json' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/vnd.mambu.v2+json' } result = RestClient.get 'https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', params: { }, headers: headers p JSON.parse(result) ``` ```python import requests headers = { 'Accept': 'application/vnd.mambu.v2+json' } r = requests.get('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', headers = headers) print(r.json()) ``` ```php 'application/vnd.mambu.v2+json', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/vnd.mambu.v2+json"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... ``` -------------------------------- ### Mambu Functions API 200 OK Response Example Source: https://api.mambu.com/mambu-functions-api An example JSON response for a successful (HTTP 200 OK) request to the Mambu Functions API, showing a list of Mambu Function objects. ```JSON [ { "name": "my-func-1", "state": "ACTIVE", "version": "v1", "lastModifiedDate": "2023-05-08T06:53:52Z", "extensionPointId": "DEPOSIT_FEE_AMOUNT", "lastDeploymentStatus": "SUCCESS", "lastDeploymentFailureReason": "" } ] ``` -------------------------------- ### List Mambu Functions API Call Examples Source: https://api.mambu.com/mambu-functions-api Code examples demonstrating how to retrieve a list of Mambu Functions using various programming languages and tools. The endpoint supports optional filtering by `extensionPointId` and/or `functionName` patterns, and pagination. The `Accept` header `application/vnd.mambu.v2+json` is required. ```curl # You can also use wget curl -X GET https://TENANT_NAME.mambu.com/api/mambu-functions \ -H 'Accept: application/vnd.mambu.v2+json' ``` ```HTTP GET https://TENANT_NAME.mambu.com/api/mambu-functions HTTP/1.1 Host: tenant_name.mambu.com Accept: application/vnd.mambu.v2+json ``` ```JavaScript const headers = { 'Accept':'application/vnd.mambu.v2+json' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```Ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/vnd.mambu.v2+json' } result = RestClient.get 'https://TENANT_NAME.mambu.com/api/mambu-functions', params: { }, headers: headers p JSON.parse(result) ``` ```Python import requests headers = { 'Accept': 'application/vnd.mambu.v2+json' } r = requests.get('https://TENANT_NAME.mambu.com/api/mambu-functions', headers = headers) print(r.json()) ``` ```PHP 'application/vnd.mambu.v2+json', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://TENANT_NAME.mambu.com/api/mambu-functions', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```Java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```Go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/vnd.mambu.v2+json"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://TENANT_NAME.mambu.com/api/mambu-functions", data); req.Header = headers; client := &http.Client{}; resp, err := client.Do(req); // ... } ``` -------------------------------- ### Example JSON for Cursor-Commit-Result Schema Source: https://api.mambu.com/streaming-api Provides a JSON example for the 'Cursor-Commit-Result' schema, showing the structure for a cursor commit operation, including the cursor details and the result status. ```JSON { "cursor": { "cursor_token": "string", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "offset": "001-0001-000000000000000000", "partition": "1" }, "result": "string" } ``` -------------------------------- ### Retrieve Mambu Function Subscriptions Source: https://api.mambu.com/mambu-functions-api This snippet demonstrates how to make a GET request to list Mambu Function Subscriptions for a specified function name. It includes examples across various programming languages and HTTP clients. ```curl curl -X GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions \ -H 'Accept: application/vnd.mambu.v2+json' \ -H 'Content-Type: string' ``` ```HTTP GET https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions HTTP/1.1 Host: tenant_name.mambu.com Accept: application/vnd.mambu.v2+json Content-Type: string ``` ```JavaScript const headers = { 'Accept':'application/vnd.mambu.v2+json', 'Content-Type':'string' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```Ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/vnd.mambu.v2+json', 'Content-Type' => 'string' } result = RestClient.get 'https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions', params: { }, headers: headers p JSON.parse(result) ``` ```Python import requests headers = { 'Accept': 'application/vnd.mambu.v2+json', 'Content-Type': 'string' } r = requests.get('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions', headers = headers) print(r.json()) ``` ```PHP 'application/vnd.mambu.v2+json', 'Content-Type' => 'string', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```Java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```Go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/vnd.mambu.v2+json"}, "Content-Type": []string{"string"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Problem API Example Source: https://api.mambu.com/streaming-api An example JSON payload for a 'Problem' object, typically used to convey error details in an API response. ```JSON { "detail": "Connection to database timed out", "instance": "http://example.com", "status": 503, "title": "Service Unavailable", "type": "http://httpstatus.es/503" } ``` -------------------------------- ### Create Subscription Response Example (JSON) Source: https://api.mambu.com/streaming-api Illustrates a sample JSON response received after successfully creating a subscription. This response includes details such as the owning application, subscribed event types, consumer group, read position, the unique subscription ID, and the creation timestamp. ```json { "owning_application": "demo-app", "event_types": [ "mrn.event.TENANT_NAME.streamingapi.client_approved" ], "consumer_group": "default", "read_from": "end", "id": "0691160a-b519-4595-b85c-a400fc73e963", "created_at": "2018-11-18T22:27:29.156Z" } ``` -------------------------------- ### Example 200 OK Response for Subscription Statistics Source: https://api.mambu.com/streaming-api Illustrates a successful response (HTTP 200) for a request to retrieve subscription statistics, showing event types, partitions, and their states, unconsumed events, and consumer lag. ```JSON { "items": [ { "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "partitions": [ { "partition": "0", "state": "unassigned", "unconsumed_events": 1, "consumer_lag_seconds": 500, "stream_id": "" }, { "partition": "1", "state": "unassigned", "unconsumed_events": 0, "consumer_lag_seconds": 0, "stream_id": "" }, { "partition": "2", "state": "unassigned", "unconsumed_events": 0, "consumer_lag_seconds": 0, "stream_id": "" } ] } ] } ``` -------------------------------- ### Mambu API: Update Function Subscription Example Responses Source: https://api.mambu.com/mambu-functions-api Provides example JSON payloads for successful (200 OK) and error (409 Conflict, 429 Too Many Requests) responses when updating a Mambu Function Subscription. ```JSON { "name": "all_savings_withdrawal", "state": "ACTIVE", "batchSize": 50, "batchWindow": 3, "event": "SAVINGS_WITHDRAWAL" } ``` ```JSON { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_OPERATION_IN_PROGRESS" } ] } ``` ```JSON { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### API Reference: GET /mambu-functions-secrets Source: https://api.mambu.com/mambu-functions-api Detailed API documentation for the GET /mambu-functions-secrets endpoint, which lists secrets used for Mambu Functions. Includes parameter definitions, example responses, and a comprehensive list of possible HTTP status codes with their meanings and associated schemas. ```APIDOC GET /mambu-functions-secrets Description: Lists the secrets used for Mambu Function. Parameters: - Name: Content-Type Type: string Description: application/json In: header Required: true Example Responses: 200 Response: { "name": "secret-name" } 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } Responses: - Status: 200 Meaning: OK (https://tools.ietf.org/html/rfc7231#section-6.3.1) Description: List of Mambu Function Secret Schema: MambuFunctionSecret (#schemamambufunctionsecret) - Status: 400 Meaning: Bad Request (https://tools.ietf.org/html/rfc7231#section-6.5.1) Description: Bad Request - Validation: This code is returned when there is malformed syntax in the request or incorrect data in the payload. Schema: ErrorResponse (#schemaerrorresponse) - Status: 401 Meaning: Unauthorized (https://tools.ietf.org/html/rfc7235#section-3.1) Description: Unauthorized Schema: ErrorResponse (#schemaerrorresponse) - Status: 403 Meaning: Forbidden (https://tools.ietf.org/html/rfc7231#section-6.5.3) Description: Forbidden Schema: ErrorResponse (#schemaerrorresponse) - Status: 429 Meaning: Too Many Requests (https://tools.ietf.org/html/rfc6585#section-4) Description: Too Many Requests Schema: ErrorResponse (#schemaerrorresponse) ``` -------------------------------- ### Example 404 Not Found Response Source: https://api.mambu.com/streaming-api Demonstrates an error response (HTTP 404) when a requested subscription ID is not found, providing details like status, title, and instance. ```JSON { "detail": "Connection to database timed out", "instance": "http://example.com", "status": 503, "title": "Service Unavailable", "type": "http://httpstatus.es/503" } ``` -------------------------------- ### Example 200 OK Response for Disabled Subscription Source: https://api.mambu.com/mambu-functions-api An example JSON response indicating a successful disable operation for a Mambu Function Subscription, showing its name, state, batch size, batch window, and event. ```JSON { "name": "all_savings_withdrawal", "state": "ACTIVE", "batchSize": 50, "batchWindow": 3, "event": "SAVINGS_WITHDRAWAL" } ``` -------------------------------- ### Example Request Body for Commit Cursors Source: https://api.mambu.com/streaming-api Illustrates the JSON structure required in the request body to commit cursors, specifying the partition, offset, event type, and an opaque cursor token. ```JSON { "items": [ { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "cursor_token": "string" } ] } ``` -------------------------------- ### Example Error Responses for Mambu API Source: https://api.mambu.com/mambu-functions-api Provides example JSON payloads for common API error responses, including Bad Request (400) and Too Many Requests (429), illustrating the structure of error codes, sources, and reasons. ```json { "errors": [ { "errorCode": 30002, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_INTERNAL_ERROR" } ] } ``` ```json { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### Commit Cursors Request Body Example Source: https://api.mambu.com/streaming-api Provides an example of the JSON payload required when committing cursors. The 'items' array contains one or more cursor objects, each specifying the partition, offset, event type, and cursor token. ```JSON { "items": [ { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.demo_tenant.streamingapi.client_approved", "cursor_token": "db4b4c27-f880-4406-a382-b057acf432cd" } ] } ``` -------------------------------- ### Example 200 OK Response for Mambu Function Logs Source: https://api.mambu.com/mambu-functions-api Illustrates a successful response structure when retrieving Mambu Function execution logs, showing a list of log entries with time, request ID, message, and log level. ```JSON { "logs": [ { "time": "1692943135231", "requestId": "785ea595-d1af-4a3a-a8b7-fa4dfc29c359", "message": "updating fee for account", "logLevel": "20" } ] } ``` -------------------------------- ### PartitionStats API Schema and Example Source: https://api.mambu.com/streaming-api Statistics of a partition within a subscription context, including consumer lag, partition ID, state, stream ID, and unconsumed events. Includes enumerated values for state. ```JSON { "consumer_lag_seconds": 0, "partition": "0", "state": "unassigned", "stream_id": "", "unconsumed_events": 0 } ``` ```APIDOC PartitionStats: consumer_lag_seconds: integer - Subscription consumer lag for this partition in seconds. Measured as the age of the oldest event of this partition that is not yet consumed within this subscription. partition (required): string - The partition id. state (required): string - The state of this partition in current subscription. Currently following values are possible: `unassigned` - the partition is currently not assigned to any client. `reassigning` - the partition is currently reassigning from one client to another. `assigned` - the partition is assigned to a client. stream_id (required): string - The id of the stream that consumes data from this partition. unconsumed_events (required): integer - The amount of events in this partition that are not yet consumed within this subscription. The property may be absent at the moment when no events were yet consumed from the partition in this subscription (In case of read_from is `BEGIN` or `END`). If the event type uses ‘compact’ cleanup policy - then the actual number of unconsumed events can be lower than the one reported in this field. Enumerated Values for state: assigned unassigned reassigning ``` -------------------------------- ### Create Mambu Function via POST Request Source: https://api.mambu.com/mambu-functions-api This snippet demonstrates how to send a POST request to the `/api/mambu-functions` endpoint to schedule a new Mambu Function for creation. It includes examples for various programming languages, showing how to set the necessary headers and request body for function definition. ```curl curl -X POST https://TENANT_NAME.mambu.com/api/mambu-functions \ -H 'Content-Type: application/json' \ -H 'Accept: application/vnd.mambu.v2+json' \ -H 'Content-Type: string' ``` ```HTTP POST https://TENANT_NAME.mambu.com/api/mambu-functions HTTP/1.1 Host: tenant_name.mambu.com Content-Type: application/json Accept: application/vnd.mambu.v2+json Content-Type: string ``` ```JavaScript const inputBody = '{ "name": "my-func-1", "extensionPointId": "DEPOSIT_FEE_AMOUNT", "version": "v1", "functionCode": { "languageId": "es2020", "code": "ZXhwb3J0cy5kZWZhdWx0ID0gYXN5bmMgZnVuY3Rpb24oaW5wdXQpIHsgCiAgcmV0dXJuIGlucHV0LnRvdGFsQmFsYW5jZSAqIDAuMDE7IAp9" } }'; const headers = { 'Content-Type':'application/json', 'Accept':'application/vnd.mambu.v2+json', 'Content-Type':'string' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions', { method: 'POST', body: inputBody, headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```Ruby require 'rest-client' require 'json' headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/vnd.mambu.v2+json', 'Content-Type' => 'string' } result = RestClient.post 'https://TENANT_NAME.mambu.com/api/mambu-functions', params: { }, headers: headers p JSON.parse(result) ``` ```Python import requests headers = { 'Content-Type': 'application/json', 'Accept': 'application/vnd.mambu.v2+json', 'Content-Type': 'string' } r = requests.post('https://TENANT_NAME.mambu.com/api/mambu-functions', headers = headers) print(r.json()) ``` ```PHP 'application/json', 'Accept' => 'application/vnd.mambu.v2+json', 'Content-Type' => 'string', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('POST','https://TENANT_NAME.mambu.com/api/mambu-functions', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```Java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```Go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Content-Type": []string{"application/json"}, "Accept": []string{"application/vnd.mambu.v2+json"}, "Content-Type": []string{"string"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("POST", "https://TENANT_NAME.mambu.com/api/mambu-functions", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... ``` -------------------------------- ### Example 409 Conflict Response for Disable Operation Source: https://api.mambu.com/mambu-functions-api An example JSON response for a 409 Conflict error, indicating that the disable operation is already in progress or cannot be performed due to a conflict. ```JSON { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "OPERATION_ALREADY_IN_PROGRESS" } ] } ``` -------------------------------- ### API Reference: POST /mambu-functions Source: https://api.mambu.com/mambu-functions-api This section provides the API documentation for the `POST /mambu-functions` endpoint, used to schedule the creation of a new Mambu Function. It details the possible deployment states, required headers, request body schema, and example success and error responses. ```APIDOC POST /mambu-functions Schedules a new function to be created and returns the Function, including its deployment state. Depending on the outcome of this operation, the returned Function might be in one of these states: | State | Description | | --- | --- | | CREATE_PENDING | Mambu Function has been queued for deployment. | | ACTIVE | Mambu Function has been successfully deployed and is ready to be used. | | FAILED | Mambu Function deployment failed. | Example Request: { "name": "my-func-1", "extensionPointId": "DEPOSIT_FEE_AMOUNT", "version": "v1", "functionCode": { "languageId": "es2020", "code": "ZXhwb3J0cy5kZWZhdWx0ID0gYXN5bmMgZnVuY3Rpb24oaW5wdXQpIHsgCiAgcmV0dXJuIGlucHV0LnRvdGFsQmFsYW5jZSAqIDAuMDE7IAp9" } } Parameters: | Name | Type | Description | In | | --- | --- | --- | --- | | Content-Type (required) | string | application/json | header | | body | [CreateMambuFunction](#schemacreatemambufunction) | Represents an action to create a Mambu Function. | body | Example Responses: 202 Response: { "name": "my-func-1", "state": "ACTIVE", "version": "v1", "lastModifiedDate": "2023-05-08T06:53:52Z", "extensionPointId": "DEPOSIT_FEE_AMOUNT", "lastDeploymentStatus": "SUCCESS", "lastDeploymentFailureReason": "" } 409 Response: { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_ALREADY_EXISTS" } ] } 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### Mambu Function Logs List Structure Source: https://api.mambu.com/mambu-functions-api Describes the structure for a collection of Mambu Function logs, showing an example list of log entries. ```APIDOC { "logs": [ { "time": "1692943135231", "requestId": "785ea595-d1af-4a3a-a8b7-fa4dfc29c359", "message": "updating fee for account", "logLevel": "20" } ] } Properties: - logs ([array]): none ``` -------------------------------- ### Mambu Functions API 429 Too Many Requests Response Example Source: https://api.mambu.com/mambu-functions-api An example JSON response for an HTTP 429 (Too Many Requests) error from the Mambu Functions API, indicating rate limit exceeded. ```JSON { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### Example 403 Forbidden Response for Commit Cursors Source: https://api.mambu.com/streaming-api Provides an example of the JSON error response returned when access is forbidden (HTTP 403 Forbidden), typically indicating authentication or authorization issues. ```JSON { "detail": "Connection to database timed out", "instance": "http://example.com", "status": 503, "title": "Service Unavailable", "type": "http://httpstatus.es/503" } ``` -------------------------------- ### Example 200 OK Response for Mambu Streaming Events Source: https://api.mambu.com/streaming-api Illustrates a successful response for a Mambu streaming API request, returning a batch of events. The response includes cursor information for tracking, metadata for each event, and the event body, typically indicating a client activity. ```JSON { "cursor": { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "cursor_token": "string" }, "info": {}, "events": [ { "metadata": { "eid": "105a76d8-db49-4144-ace7-e683e8f4ba46", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "occurred_at": "1996-12-19T16:39:57-08:00", "content_type": "text/plain; charset=UTF-8", "category": "string" }, "body": "Client was modified. Activity type: CLIENT_SET_TO_INACTIVE. Date: 27-11-2018.\n", "template_name": "Client activity template" } ] } ``` -------------------------------- ### Example 429 Too Many Requests Response Source: https://api.mambu.com/mambu-functions-api An example JSON response for a 429 Too Many Requests error, indicating that the API rate limit has been exceeded for Mambu Functions. ```JSON { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### API Reference: POST /mambu-functions/{functionName}/subscriptions Source: https://api.mambu.com/mambu-functions-api Detailed API documentation for creating a new Mambu Function Subscription, including request body structure, parameters, and example responses for various HTTP status codes. ```APIDOC Endpoint: POST /mambu-functions/{functionName}/subscriptions Purpose: Creates a new Mambu Function Subscription. Example Request Body: { "name": "all_savings_withdrawal", "event": "ACCOUNT_IN_ARREARS", "batchSize": 50, "batchWindow": 3 } Parameters: - Name: Content-Type (required) Type: string Description: application/json In: header - Name: functionName (required) Type: string Description: The name of the Function whose subscription is to be created. In: path - Name: body Type: [CreateMambuFunctionSubscription](#schemacreatemambufunctionsubscription) Description: Represents an action to create a Mambu Function Subscription. In: body Example Responses: - 201 Response: { "name": "all_savings_withdrawal", "state": "ACTIVE", "batchSize": 50, "batchWindow": 3, "event": "SAVINGS_WITHDRAWAL" } - 409 Response: { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_ALREADY_EXISTS" } ] } - 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### API Endpoint Reference: GET /mambu-functions Source: https://api.mambu.com/mambu-functions-api Detailed API documentation for the `GET /mambu-functions` endpoint. This operation retrieves a list of Mambu Functions and supports optional filtering by `extensionPointId` and/or `functionName` using `*` (matches everything) and `?` (matches any single character) pattern symbols. Pagination is also supported for managing large result sets. ```APIDOC GET /mambu-functions Description: Gets a list of Mambu Functions, with optional filtering by `extensionPointId` and/or `functionName` patterns. Supported Pattern Symbols: - `*`: Matches everything - `?`: Matches any single character Pagination: Supported ``` -------------------------------- ### Example 200 OK Response for Commit Cursors Source: https://api.mambu.com/streaming-api Shows the JSON structure returned upon a successful commit operation (HTTP 200 OK), detailing the committed cursor and its result. ```JSON { "items": [ { "cursor": { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "cursor_token": "string" }, "result": "string" } ] } ``` -------------------------------- ### Create Subscription API Endpoint (POST /subscriptions) Source: https://api.mambu.com/streaming-api Documents the `POST /subscriptions` endpoint, which is used to create a new subscription for specific event types. It outlines the purpose of subscriptions for high-level consumption, how they are identified by key parameters, and their idempotent behavior. Includes example request and response payloads. ```APIDOC Endpoint: POST /subscriptions Description: This endpoint creates a subscription for 'event_types'. Event types must first be specified using the Mambu UI. - The subscription is needed to be able to consume events from 'event_types' in a high level way when Mambu stores the offsets and manages the rebalancing of consuming clients. - The subscription is identified by its key parameters (owning_application, event_types, consumer_group). - If this endpoint is invoked several times with the same key subscription properties in body (order of event_types is not important) - the subscription will be created only once and for all other calls it will just return the subscription that was already created. Parameters: - Name: apikey Type: string Description: your API key In: header Required: true - Name: body Type: [Subscription](#schemasubscription) Description: Subscription is a high level consumption unit. Subscriptions allow applications to easily scale the number of clients by managing consumed event offsets and distributing load between instances. The key properties that identify a subscription are 'owning_application', 'event_types' and 'consumer_group'. It is not possible to have two different subscriptions with these properties being the same. In: body Required: true Example Request: { "owning_application": "demo", "event_types": [ "mrn.event.TENANT_NAME.streamingapi.client_approved" ], "consumer_group": "read-product-updates", "read_from": "end", "initial_cursors": [ { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved" } ] } Example Responses: 200: A subscription { "id": "0691160a-b519-4595-b85c-a400fc73e963", "owning_application": "demo", "event_types": [ "mrn.event.TENANT_NAME.streamingapi.client_approved" ], "consumer_group": "read-product-updates", "created_at": "1996-12-19T16:39:57-08:00", "updated_at": "1996-12-19T16:39:57-08:00", "read_from": "end", "initial_cursors": [ { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved" } ] } 201: A newly created subscription { "id": "0691160a-b519-4595-b85c-a400fc73e963", "owning_application": "demo", "event_types": [ "mrn.event.TENANT_NAME.streamingapi.client_approved" ], "consumer_group": "read-product-updates", "created_at": "1996-12-19T16:39:57-08:00", "updated_at": "1996-12-19T16:39:57-08:00", "read_from": "end", "initial_cursors": [ { "partition": "1", "offset": "001-0001-000000000000000000", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved" } ] } 400: Response { "detail": "Connection to database timed out", "instance": "http://example.com", "status": 503, "title": "Service Unavailable", "type": "http://httpstatus.es/503" } ``` -------------------------------- ### Enable Mambu Function Subscription via API Source: https://api.mambu.com/mambu-functions-api This section provides code examples for enabling a Mambu Function Subscription using a PUT request. The API endpoint requires the function name and subscription name as path parameters and an 'Accept' header. Successful execution updates the subscription status. The endpoint is `PUT /mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable`. ```curl # You can also use wget curl -X PUT https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable \ -H 'Accept: application/vnd.mambu.v2+json' ``` ```HTTP PUT https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable HTTP/1.1 Host: tenant_name.mambu.com Accept: application/vnd.mambu.v2+json ``` ```JavaScript const headers = { 'Accept':'application/vnd.mambu.v2+json' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable', { method: 'PUT', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```Ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/vnd.mambu.v2+json' } result = RestClient.put 'https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable', params: { }, headers: headers p JSON.parse(result) ``` ```Python import requests headers = { 'Accept': 'application/vnd.mambu.v2+json' } r = requests.put('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable', headers = headers) print(r.json()) ``` ```PHP 'application/vnd.mambu.v2+json', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('PUT','https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```Java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("PUT"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```Go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/vnd.mambu.v2+json"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("PUT", "https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}/enable", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Event API Schema and Example Source: https://api.mambu.com/streaming-api Payload of an Event, usually representing a status transition in a Business process. Includes its structure and properties. ```JSON { "body": "Client was modified. Activity type: CLIENT_SET_TO_INACTIVE. Date: 27-11-2018.\n", "metadata": { "category": "string", "content_type": "text/plain; charset=UTF-8", "eid": "105a76d8-db49-4144-ace7-e683e8f4ba46", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "occurred_at": "1996-12-19T16:39:57-08:00" }, "template_name": "Client activity template" } ``` ```APIDOC Event: body (required): string - Actual content of the notification. metadata (required): [Event-Metadata](#schemaevent-metadata) - Metadata for this Event. template_name (required): string - Name of the notification template. ``` -------------------------------- ### Authenticate GET Request with API Key (cURL) Source: https://api.mambu.com/streaming-api Demonstrates how to make an authenticated GET request to the Mambu Streaming API using cURL. The request includes the 'apikey' header for authentication, targeting a specific subscription's events endpoint. ```curl curl --request GET 'https://TENANT_NAME.mambu.com/api/v1/subscriptions/d45a34ed341321bca4d89e42452dc074/events' \ --header 'apikey: i9TCzwUBwyTVQrfPEAhk0oEpOUCt0O2M' ``` -------------------------------- ### API Endpoint: GET /subscriptions/{subscription-id}/events Source: https://api.mambu.com/streaming-api API documentation for consuming events from an existing subscription. This endpoint requires a GET request to the /subscriptions/{subscription-id}/events resource, where {subscription-id} is the unique identifier of the subscription from which events are to be retrieved. ```APIDOC GET /subscriptions/{subscription-id}/events Purpose: Consume events from an existing subscription. Path Parameters: subscription-id: string (UUID, Required) - The unique identifier of the subscription from which to consume events. ``` -------------------------------- ### API Reference: POST /mambu-functions-secrets Source: https://api.mambu.com/mambu-functions-api This section provides the detailed API documentation for creating a new secret for Mambu Functions. It includes the endpoint, purpose, example request body, required parameters, and various example success and error responses. ```APIDOC POST /mambu-functions-secrets Creates a new secret used for Mambu Functions and returns the created secret name. Example Request: { "name": "secret-name", "value": "1234" } Parameters: Name | Type | Description | In --- | --- | --- | --- Content-Type (required) | string | application/json | header body | [CreateMambuFunctionSecret](#schemacreatemambufunctionsecret) | Represents an action to create a secret used for Mambu Functions. | body Example Responses: 201 Response: { "name": "secret-name" } 409 Response: { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_ALREADY_EXISTS" } ] } 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } ``` -------------------------------- ### API Reference: PUT /mambu-functions/{functionName} Source: https://api.mambu.com/mambu-functions-api This section provides the API documentation for updating a Mambu Function. It details the endpoint, its purpose, and the possible deployment states of the function after the update operation. An example request body is also provided. ```APIDOC PUT /mambu-functions/{functionName} Schedules a function to be updated and returns the current Function, including its deployment state. Depending on the outcome of this operation, the returned Function might be in one of these states: | State | Description | | --- | --- | | UPDATE_PENDING | Mambu Function has been queued for update. | | ACTIVE | Mambu Function has been successfully deployed and is ready to be used. | | FAILED | Mambu Function deployment failed. | Example Request Body: { "version": "v1", "functionCode": { "languageId": "es2020", "code": "ZXhwb3J0cy5kZWZhdWx0ID0gYXN5bmMgZnVuY3Rpb24oaW5wdXQpIHsgCiAgcmV0dXJuIGlucHV0LnRvdGFsQmFsYW5jZSAqIDAuMDE7IAp9" } } ``` -------------------------------- ### Event-Metadata API Schema and Example Source: https://api.mambu.com/streaming-api Metadata for an Event, detailing its category, content type, unique identifier, event type, and occurrence timestamp. Includes enumerated values for content_type. ```JSON { "category": "string", "content_type": "text/plain; charset=UTF-8", "eid": "105a76d8-db49-4144-ace7-e683e8f4ba46", "event_type": "mrn.event.TENANT_NAME.streamingapi.client_approved", "occurred_at": "1996-12-19T16:39:57-08:00" } ``` ```APIDOC Event-Metadata: category (required): string - Indicates if the content of the notification can be configured in Mambu or it is fixed. Currently only one category is supported: `DATA` content_type (required): string - Notification content format. eid (required): string(uuid) - Unique identifier of this Event. Consumers MIGHT use this value to assert uniqueness of reception of the Event. event_type (required): string - The EventType of this Event. occurred_at (required): string(date-time) - Timestamp of creation of the Event generated by Mambu. Enumerated Values for content_type: application/xml application/json text/plain; charset=UTF-8 ``` -------------------------------- ### Get Subscription Statistics (GET /subscriptions/{subscription_id}/stats) Source: https://api.mambu.com/streaming-api This endpoint provides statistics for a specified subscription, useful for monitoring consumer lag. It requires an API key and accepts an optional `show_time_lag` query parameter. The statistics are calculated by comparing the latest offset with the committed offset to determine unconsumed events. ```APIDOC GET /subscriptions/{subscription_id}/stats ``` ```HTTP GET https://TENANT_NAME.mambu.com/api/v1/subscriptions/0691160a-b519-4595-b85c-a400fc73e96/stats?show_time_lag=true HTTP/1.1 Accept: application/json apikey: string ``` -------------------------------- ### Mambu Function API Parameters and Responses Source: https://api.mambu.com/mambu-functions-api Details the required path parameters and possible HTTP responses for Mambu Function API calls, including example JSON payloads for success (200 OK) and common error cases (409 Conflict, 429 Too Many Requests). ```APIDOC Parameters: functionName (required): string - The name of the Function. (In: path) subscriptionName (required): string - The name of the subscription to enable. (In: path) Example Responses: 200 OK: { "name": "all_savings_withdrawal", "state": "ACTIVE", "batchSize": 50, "batchWindow": 3, "event": "SAVINGS_WITHDRAWAL" } 409 Conflict: { "errors": [ { "errorCode": 30000, "errorSource": "A human-readable message", "errorReason": "OPERATION_ALREADY_IN_PROGRESS" } ] } 429 Too Many Requests: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } Responses: 200 OK: Mambu Function Subscription update status (Schema: MambuFunctionSubscription) 400 Bad Request: Bad Request - Validation: This code is returned when there is malformed syntax in the request or incorrect data in the payload. (Schema: ErrorResponse) 401 Unauthorized: Unauthorized (Schema: ErrorResponse) 403 Forbidden: Forbidden (Schema: ErrorResponse) 409 Conflict: Conflict - Validation: This code is returned when there is another concurrent operation on the same function (Schema: ErrorResponse) 429 Too Many Requests: Too Many Requests (Schema: ErrorResponse) ``` -------------------------------- ### Example 202 Accepted Response for Mambu Function Update Source: https://api.mambu.com/mambu-functions-api Illustrates a successful 202 Accepted response payload after updating a Mambu Function, showing its name, state, version, last modification date, extension point, and deployment status. ```JSON { "name": "my-func-1", "state": "ACTIVE", "version": "v1", "lastModifiedDate": "2023-05-08T06:53:52Z", "extensionPointId": "DEPOSIT_FEE_AMOUNT", "lastDeploymentStatus": "SUCCESS", "lastDeploymentFailureReason": "" } ``` -------------------------------- ### API Reference: GET /mambu-functions/{functionName}/subscriptions Source: https://api.mambu.com/mambu-functions-api Documents the API endpoint for listing Mambu Function Subscriptions, including parameters, response codes, and schema details. ```APIDOC GET /mambu-functions/{functionName}/subscriptions Lists the Mambu Function Subscriptions of a specific `functionName`. Parameters: Name: Content-Type (required) Type: string Description: application/json In: header Name: functionName (required) Type: string Description: The name of the Function to get Subscriptions for. In: path Example Responses: 200 Response: [ { "name": "all_savings_withdrawal" } ] 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } Responses: Status: 200 Meaning: OK Description: List of Mambu Function Subscriptions Schema: Inline Status: 400 Meaning: Bad Request Description: Bad Request - Validation: This code is returned when there is malformed syntax in the request or incorrect data in the payload. Schema: ErrorResponse Status: 401 Meaning: Unauthorized Description: Unauthorized Schema: ErrorResponse Status: 403 Meaning: Forbidden Description: Forbidden Schema: ErrorResponse Status: 429 Meaning: Too Many Requests Description: Too Many Requests Schema: ErrorResponse Response Schema (Status Code 200): Name: *anonymous* Type: [[MambuFunctionSubscriptionListItem](#schemamambufunctionsubscriptionlistitem)] Description: [Represents an item in the list of returned Mambu Function Subscriptions.] Restrictions: none Name: » name Type: string Description: The name of the Mambu Function Subscription. Restrictions: none ``` -------------------------------- ### API Documentation for Delete Mambu Function Source: https://api.mambu.com/mambu-functions-api Detailed API documentation for the DELETE /mambu-functions/{functionName} endpoint, including parameters, example error responses, and status codes with their meanings and schemas. ```APIDOC DELETE /mambu-functions/{functionName} Description: Schedules the specified Mambu Function for removal, provided that it is not already bound to a product. The actual removal will happen after 24 hours. If the removal is scheduled successfully, the Function will be in the REMOVING state. If the removal fails after the grace period the state will change to FAILED. Parameters: - functionName (required): Type: string Description: The name of the Function to be deleted. In: path Example Responses: - 400 Response: { "errors": [ { "errorCode": 30002, "errorSource": "A human-readable message", "errorReason": "MFUNCTION_INTERNAL_ERROR" } ] } - 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } Responses: - 204 No Content: Description: Mambu Function deleted. Schema: None - 400 Bad Request: Description: Bad Request - Validation: This code is returned when there is malformed syntax in the request or incorrect data in the payload. Schema: [ErrorResponse](#schemaerrorresponse) - 401 Unauthorized: Description: Unauthorized Schema: [ErrorResponse](#schemaerrorresponse) - 403 Forbidden: Description: Forbidden Schema: [ErrorResponse](#schemaerrorresponse) - 404 Not Found: Description: Mambu Function not found Schema: [ErrorResponse](#schemaerrorresponse) - 429 Too Many Requests: Description: Too Many Requests Schema: [ErrorResponse](#schemaerrorresponse) ``` -------------------------------- ### Mambu Function Secret API Parameters and Responses Source: https://api.mambu.com/mambu-functions-api Details the request parameters, example responses, and possible HTTP status codes and their meanings for Mambu Function Secret operations. ```APIDOC Parameters: - Content-Type (required): Type: string Description: application/json In: header - name (required): Type: string Description: The name of the Mambu Function Secret. In: path - body: Type: [UpdateMambuFunctionSecret](#schemaupdatemambufunctionsecret) Description: Request payload to update Mambu Function Secret value. In: body Example Responses: 200 Response: { "name": "secret-name" } 429 Response: { "errors": [ { "errorCode": 300013, "errorSource": "Request rate limit exceeded. Please try again later.", "errorReason": "MFUNCTION_RATE_LIMIT_EXCEEDED" } ] } Responses: - 200 OK: Description: Mambu Function Secret updated Schema: [MambuFunctionSecret](#schemamambufunctionsecret) - 400 Bad Request: Description: Bad Request - Validation: This code is returned when there is malformed syntax in the request or incorrect data in the payload. Schema: [ErrorResponse](#schemaerrorresponse) - 401 Unauthorized: Description: Unauthorized Schema: [ErrorResponse](#schemaerrorresponse) - 403 Forbidden: Description: Forbidden Schema: [ErrorResponse](#schemaerrorresponse) - 429 Too Many Requests: Description: Too Many Requests Schema: [ErrorResponse](#schemaerrorresponse) ``` -------------------------------- ### Update Mambu Function Subscription via PUT Request Source: https://api.mambu.com/mambu-functions-api Demonstrates how to update an existing Mambu Function Subscription using various programming languages and HTTP clients. The examples show how to construct the PUT request, set necessary headers, and handle the response. ```Shell curl -X PUT https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName} \ -H 'Content-Type: application/json' \ -H 'Accept: application/vnd.mambu.v2+json' \ -H 'Content-Type: string' ``` ```HTTP PUT https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName} HTTP/1.1 Host: tenant_name.mambu.com Content-Type: application/json Accept: application/vnd.mambu.v2+json Content-Type: string ``` ```JavaScript const inputBody = '{ "batchSize": 50, "batchWindow": 10 }'; const headers = { 'Content-Type':'application/json', 'Accept':'application/vnd.mambu.v2+json', 'Content-Type':'string' }; fetch('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', { method: 'PUT', body: inputBody, headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` ```Ruby require 'rest-client' require 'json' headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/vnd.mambu.v2+json', 'Content-Type' => 'string' } result = RestClient.put 'https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', params: { }, headers: headers p JSON.parse(result) ``` ```Python import requests headers = { 'Content-Type': 'application/json', 'Accept': 'application/vnd.mambu.v2+json', 'Content-Type': 'string' } r = requests.put('https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', headers = headers) print(r.json()) ``` ```PHP 'application/json', 'Accept' => 'application/vnd.mambu.v2+json', 'Content-Type' => 'string', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('PUT','https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` ```Java URL obj = new URL("https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("PUT"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` ```Go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Content-Type": []string{"application/json"}, "Accept": []string{"application/vnd.mambu.v2+json"}, "Content-Type": []string{"string"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("PUT", "https://TENANT_NAME.mambu.com/api/mambu-functions/{functionName}/subscriptions/{subscriptionName}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` ```JSON { "batchSize": 50, "batchWindow": 10 } ```