elmah
Module elmah
API
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_elmah_1.5.0.png)
ballerinax/elmah Ballerina library
Overview
This is a generated connector for Elmah.io REST API v3 OpenAPI Specification.
The public REST API for elmah.io. All of the integrations communicates with elmah.io through this API.
For additional help getting started with the API, visit the following help articles:
- [Using the REST API](https://docs.elmah.io/using-the-rest-api/)
- [Where is my API key?](https://docs.elmah.io/where-is-my-api-key/)
- [Where is my log ID?](https://docs.elmah.io/where-is-my-log-id/)
- [How to configure API key permissions](https://docs.elmah.io/how-to-configure-api-key-permissions/)
Prerequisites
- Create an Elmah account
- Obtain tokens
- Use this guide to obtain the API key related to your account
- Configure the API key to have necessary permissions
Quickstart
To use the Elmah.io connector in your Ballerina application, update the .bal file as follows:
Step 1 - Import connector
First, import the ballerinax/hubspot.crm.pipeline module into the Ballerina project.
import ballerinax/elmah;
Step 2 - Create a new connector instance
You can now make the connection configuration using the access token.
elmah:ApiKeysConfig config = { apikey : "<your apiKey>" }; elmah:Client baseClient = check new Client(config);
Step 3 - Invoke connector operation
- Create a deployment
elmah:CreateDeployment dep = { 'version: "0.1.8", created: "2021-07-28T11:26:00.834Z" }; elmah:CreateDeploymentResult|error bEvent = baseClient->deploymentsCreate(dep); if (bEvent is elmah:CreateDeploymentResult) { log:printInfo("Deplyment" + bEvent.toString()); } else { log:printError(msg = bEvent.message()); }
- List deployments
elmah:Deployment[]|error bEvent = baseClient->deploymentsGetAll(); if (bEvent is elmah:Deployment[]) { log:printInfo("Deployment list" + bEvent.toString()); } else { log:printError((msg = bEvent.message()); }
- Use
bal run
command to compile and run the Ballerina program
Clients![](/images/permalink.svg)
elmah: Client![](/images/permalink.svg)
This is a generated connector for Elmah.io REST API v3 OpenAPI Specification. The public REST API for elmah.io. All of the integrations communicates with elmah.io through this API. For additional help getting started with the API, visit the following help articles:
- [Using the REST API](https://docs.elmah.io/using-the-rest-api/)
- [Where is my API key?](https://docs.elmah.io/where-is-my-api-key/)
- [Where is my log ID?](https://docs.elmah.io/where-is-my-log-id/)
- [How to configure API key permissions](https://docs.elmah.io/how-to-configure-api-key-permissions/)
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create an Elmah account and obtain tokens following this guide.
Configure the API key to have the required permission.
init (ApiKeysConfig apiKeyConfig, ConnectionConfig config, string serviceUrl)
- apiKeyConfig ApiKeysConfig - API keys for authorization
- config ConnectionConfig {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.elmah.io" - URL of the target service
deploymentsGetAll![](/images/permalink.svg)
function deploymentsGetAll() returns Deployment[]|error
Fetch a list of deployments.
Return Type
- Deployment[]|error - Request for deployments successful.
deploymentsCreate![](/images/permalink.svg)
function deploymentsCreate(CreateDeployment payload) returns CreateDeploymentResult|error
Create a new deployment.
Parameters
- payload CreateDeployment - The deployment object to create.
Return Type
- CreateDeploymentResult|error - Deployment was created.
deploymentsGet![](/images/permalink.svg)
function deploymentsGet(string id) returns Deployment|error
Fetch a deployment by its ID.
Parameters
- id string - The ID of the deployment to fetch.
Return Type
- Deployment|error - Request for deployment successful.
deploymentsDelete![](/images/permalink.svg)
Delete a deployment by its ID.
Parameters
- id string - The ID of the deployment to delete.
heartbeatsCreate![](/images/permalink.svg)
function heartbeatsCreate(string id, string logId, CreateHeartbeat payload) returns Response|error
Create a new heartbeat.
Parameters
- id string - The ID of the heartbeat check.
- logId string - The ID of the log containing the heartbeat check.
- payload CreateHeartbeat - The details of the heartbeat.
logsGetAll![](/images/permalink.svg)
Fetch a list of logs.
logsCreate![](/images/permalink.svg)
function logsCreate(CreateLog payload) returns CreateLogResult|error
Create a new log.
Parameters
- payload CreateLog - The log object to create.
Return Type
- CreateLogResult|error - Log where successfully created.
logsGet![](/images/permalink.svg)
Fetch a log by its ID.
Parameters
- id string - The ID of the log to fetch.
logsDisable![](/images/permalink.svg)
Disable a log by its ID.
Parameters
- id string - The ID of the log to disable.
logsEnable![](/images/permalink.svg)
Enable a log by its ID.
Parameters
- id string - The ID of the log to enable.
messagesGetAll![](/images/permalink.svg)
function messagesGetAll(string logId, int pageIndex, int pageSize, string? query, string? 'from, string? to, boolean includeHeaders) returns MessagesResult|error
Fetch messages from a log.
Parameters
- logId string - The ID of the log containing the messages.
- pageIndex int (default 0) - The page number of the result.
- pageSize int (default 15) - The number of messages to load (max 100) or 15 if not set.
- query string? (default ()) - A full-text or Lucene query to limit the messages by.
- 'from string? (default ()) - A start date and time to search from (not included).
- to string? (default ()) - An end date and time to search to (not included).
- includeHeaders boolean (default false) - Include headers like server variables and cookies in the result (slower).
Return Type
- MessagesResult|error - Log found and may contain messages.
messagesCreate![](/images/permalink.svg)
function messagesCreate(string logId, CreateMessage payload) returns CreateMessageResult|error
Create a new message.
Parameters
- logId string - The ID of the log which should contain the new message.
- payload CreateMessage - The message object to create.
Return Type
- CreateMessageResult|error - Message was not created.
messagesDeleteAll![](/images/permalink.svg)
Deletes a list of messages by logid and query.
Parameters
- logId string - The ID of the log containing the message.
messagesCreateBulk![](/images/permalink.svg)
function messagesCreateBulk(string logId, CreateMessage[] payload) returns CreateBulkMessageResult[]|error
Create one or more new messages.
Parameters
- logId string - The ID of the log which should contain the new messages.
- payload CreateMessage[] - The messages to create.
Return Type
- CreateBulkMessageResult[]|error - Zero or more messages where successfully created. Check the response body for details.
messagesGet![](/images/permalink.svg)
Fetch a message by its ID.
Parameters
- id string - The ID of the message to fetch.
- logId string - The ID of the log containing the message.
messagesDelete![](/images/permalink.svg)
Delete a message by its ID.
Parameters
- id string - The ID of the message to delete.
- logId string - The ID of the log containing the message.
messagesFix![](/images/permalink.svg)
Fix a message by its ID.
Parameters
- id string - The ID of the message to fix.
- logId string - The ID of the log containing the message.
- markAllAsFixed boolean (default false) - If set to true, all instances of the log message are set to fixed.
messagesHide![](/images/permalink.svg)
Hide a message by its ID.
Parameters
- id string - The ID of the message to hide.
- logId string - The ID of the log containing the message.
uptimeChecksGetAll![](/images/permalink.svg)
function uptimeChecksGetAll() returns UptimeCheck[]|error
Fetch a list of uptime checks. Currently in closed beta. Get in contact to get access to this endpoint.
Return Type
- UptimeCheck[]|error - Request for uptime checks successful.
Records![](/images/permalink.svg)
elmah: ApiKeysConfig![](/images/permalink.svg)
Provides API key configurations needed when communicating with a remote HTTP endpoint.
Fields
- apiKey string - All requests on the elmah.io API needs to include an API key. The API key can be provided as part of the query string or as a request header. The name of the API key needs to be <code>api_key</code>.<br/><br/>Additional resources:<br/><ul><li>Where is my API key?</li><li>How to configure API key permissions</li></ul>
elmah: Breadcrumb![](/images/permalink.svg)
A breadcrumb represent a step preceding a log message.
Fields
- action string? - An action representing the breadcrumb. You can set a custom action or use one of the built-in: click, submit, navigation, request, error.
- dateTime string? - The date and time in UTC of the breadcrumb. If no date and time is provided, we will use the current date and time in UTC.
- message string? - A message representing the breadcrumb. This should elaborate on the action.
- severity string? - An enum value representing the severity of this breadcrumb. The following values are allowed: Verbose, Debug, Information, Warning, Error, Fatal.
elmah: ClientHttp1Settings![](/images/permalink.svg)
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
elmah: ConnectionConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
elmah: CreateBulkMessageResult![](/images/permalink.svg)
The result of create bulk operation.
Fields
- location string? - The location of the created message if StatusCode equals Created.
- statusCode int? - Status code of the individual messages as if it were being created through the non-bulk endpoint. If a message was succesfully created, the status code will be 201 and location will contain an URL. If a message was ignored, the status code will be 200 and the location will be empty.
elmah: CreateDeployment![](/images/permalink.svg)
Deployment information.
Fields
- created string? - When was this deployment created in UTC. Defaults to current time if not specified.
- description string? - Optional description of this deployment. Can be markdown or clear text.
- logId string? - As default, deployments are attached all logs of the organization. If you want a deployment to attach to a single log only, set this to the ID of that log.
- userEmail string? - The email of the person responsible for creating this deployment. This can be the email taken from your deployment server (like VSTS or Octopus).
- userName string? - The name of the person responsible for creating this deployment. This can be the name taken from your deployment server (like VSTS or Octopus).
- 'version string - The version number of this deployment. The value of version can be a SemVer compliant string or any other syntax that you are using as your version numbering scheme.
elmah: CreateDeploymentResult![](/images/permalink.svg)
The result of create deployment operation.
Fields
- location string? - The location of the created deployment.
elmah: CreateHeartbeat![](/images/permalink.svg)
Heartbeat information.
Fields
- application string? - Optional string to identify which application logged this message. You can use this if you have multiple applications and services logging to the same log. If not set, the application name "Heartbeats" will be set on all log messages generated from this heartbeat.
- reason string? - If result is "Degraded" or "Unhealthy" you can use this property to specify why.
- result string? - The result of this heartbeat. Can be "Healthy", "Degraded", or "Unhealthy". Defaults to "Healthy"
- took int? - Optional long for specifying how many milliseconds it took to execute the task resulting in this heartbeat. This can be used to get a better overview of how long a scheduled task or service is running or to figure out if the grace period should be increased.
- 'version string? - Optional string to identify which version of your application logged this message. If not specified, any errors, warnings, or information messages will get the newest version number created through deployment tracking as with normal log messages.
elmah: CreateLog![](/images/permalink.svg)
Log information.
Fields
- name string - Name of the new log.
elmah: CreateLogResult![](/images/permalink.svg)
The result of create log operation.
Fields
- location string? - The location of the created log.
elmah: CreateMessage![](/images/permalink.svg)
Message information.
Fields
- application string? - Used to identify which application logged this message. You can use this if you have multiple applications and services logging to the same log
- breadcrumbs Breadcrumb[]? - A list of breadcrumbs preceding this log message.
- code string? - Code can be used to include source code related to the log message. The code will typically span from a few lines before the line causing the log message to a few lines after. For now, all lines above 21 will be removed. This makes room for showing 10 lines before the logging line, the logging line, and 10 lines after the logging line. Don't include a very large string in this property since that will quickly make the entire messages exceed the max limit of 256 kb.
- cookies Item[]? - A key/value pair of cookies. This property only makes sense for logging messages related to web requests.
- correlationId string? - CorrelationId can be used to group similar log messages together into a single discoverable batch. A correlation ID could be a session ID from ASP.NET Core, a unique string spanning multiple microsservices handling the same request, or similar.
- data Item[]? - A key/value pair of user-defined fields and their values. When logging an exception, the Data dictionary of the exception is copied to this property. You can add additional key/value pairs, by modifying the Data dictionary on the exception or by supplying additional key/values to this API.
- dateTime string? - The date and time in UTC of the message. If you don't provide us with a value in dateTime, we will set the current date and time in UTC.
- detail string? - A longer description of the message. For errors this could be a stacktrace, but it's really up to you what to log in there.
- form Item[]? - A key/value pair of form fields and their values. This property makes sense if logging message related to users inputting data in a form.
- hostname string? - The hostname of the server logging the message.
- method string? - If message relates to a HTTP request, you may send the HTTP method of that request. If you don't provide us with a method, we will try to find a key named REQUEST_METHOD in serverVariables.
- queryString Item[]? - A key/value pair of query string parameters. This property makes sense if logging message related to a HTTP request.
- serverVariables Item[]? - A key/value pair of server values. Server variables are typically related to handling requests in a webserver but could be used for other types of information as well.
- severity string? - An enum value representing the severity of this message. The following values are allowed: Verbose, Debug, Information, Warning, Error, Fatal
- 'source string? - The source of the code logging the message. This could be the assembly name.
- statusCode int? - If the message logged relates to a HTTP status code, you can put the code in this property. This would probably only be relevant for errors, but could be used for logging successful status codes as well.
- title string? - The textual title or headline of the message to log.
- titleTemplate string? - The title template of the message to log. This property can be used from logging frameworks that supports structured logging like: "{user} says {quote}". In the example, titleTemplate will be this string and title will be "Gilfoyle says It's not magic. It's talent and sweat".
- 'type string? - The type of message. If logging an error, the type of the exception would go into type but you can put anything in there, that makes sense for your domain.
- url string? - If message relates to a HTTP request, you may send the URL of that request. If you don't provide us with an URL, we will try to find a key named URL in serverVariables.
- user string? - An identification of the user triggering this message. You can put the users email address or your user key into this property.
- 'version string? - Versions can be used to distinguish messages from different versions of your software. The value of version can be a SemVer compliant string or any other syntax that you are using as your version numbering scheme.
elmah: CreateMessageResult![](/images/permalink.svg)
The result of create message operation.
Fields
- location string? - The location of the created message.
elmah: Deployment![](/images/permalink.svg)
Deployment information
Fields
- created string? - When was this deployment created.
- createdBy string? - The elmah.io id of the user creating this deployment. Since deployments are created on a subscription, the CreatedBy will contain the id of the user with the subscription.
- description string? - Sescription of this deployment in markdown or clear text.
- id string? - The ID of this deployment.
- logId string? - If the deployment is attached a single log, this property is set to the ID of that log. If null, the deployment is attached all logs on the organization.
- userEmail string? - The email of the person responsible for creating this deployment.
- userName string? - The name of the person responsible for creating this deployment.
- 'version string? - The version number of this deployment. The value of version can be a SemVer compliant string or any other syntax that you are using as your version numbering scheme.
elmah: Item![](/images/permalink.svg)
Represents a key value pair.
Fields
- 'key string? - The key of the item.
- value string? - The value of the item.
elmah: Log![](/images/permalink.svg)
Properties of Log.
Fields
- color string? - Color of the log. The color will always be one of the following (green being the default): green, lightgreen, lime, yellow, orange, deeporange, red, pink, purple, deeppurple, blue, lightblue
- disabled boolean? - Returns true if the log is currently disabled. A log can be disabled either through the API or in the elmah.io UI.
- environmentName string? - Environment name this log is in or "Other" if not in an environment. "Other" is chosen over null to mimic the experience in the elmah.io UI.
- id string? - ID of the log.
- name string? - Name of the log.
elmah: Message![](/images/permalink.svg)
Properties of Message.
Fields
- application string? - Used to identify which application logged this message. You can use this if you have multiple applications and services logging to the same log
- breadcrumbs Breadcrumb[]? - A list of breadcrumbs preceding this log message.
- code string? - Code can be used to include source code related to the log message. The code will typically span from a few lines before the line causing the log message to a few lines after. For now, all lines above 21 will be removed. This makes room for showing 10 lines before the logging line, the logging line, and 10 lines after the logging line. Don't include a very large string in this property since that will quickly make the entire messages exceed the max limit of 256 kb.
- cookies Item[]? - A key/value pair of cookies. This property only makes sense for logging messages related to web requests.
- correlationId string? - CorrelationId can be used to group similar log messages together into a single discoverable batch. A correlation ID could be a session ID from ASP.NET Core, a unique string spanning multiple microsservices handling the same request, or similar.
- data Item[]? - A key/value pair of user-defined fields and their values. When logging an exception, the Data dictionary of the exception is copied to this property. You can add additional key/value pairs, by modifying the Data dictionary on the exception or by supplying additional key/values to this API.
- dateTime string? - The date and time in UTC of the message. If you don't provide us with a value in dateTime, we will set the current date and time in UTC.
- detail string? - A longer description of the message. For errors this could be a stacktrace, but it's really up to you what to log in there.
- form Item[]? - A key/value pair of form fields and their values. This property makes sense if logging message related to users inputting data in a form.
- hostname string? - The hostname of the server logging the message.
- id string? - The ID of this message.
- method string? - If message relates to a HTTP request, you may send the HTTP method of that request. If you don't provide us with a method, we will try to find a key named REQUEST_METHOD in serverVariables.
- queryString Item[]? - A key/value pair of query string parameters. This property makes sense if logging message related to a HTTP request.
- serverVariables Item[]? - A key/value pair of server values. Server variables are typically related to handling requests in a webserver but could be used for other types of information as well.
- severity string? - An enum value representing the severity of this message. The following values are allowed: Verbose, Debug, Information, Warning, Error, Fatal
- 'source string? - The source of the code logging the message. This could be the assembly name.
- statusCode int? - If the message logged relates to a HTTP status code, you can put the code in this property. This would probably only be relevant for errors, but could be used for logging successful status codes as well.
- title string? - The textual title or headline of the message to log.
- titleTemplate string? - The title template of the message to log. This property can be used from logging frameworks that supports structured logging like: "{user} says {quote}". In the example, titleTemplate will be this string and title will be "Gilfoyle says It's not magic. It's talent and sweat".
- 'type string? - The type of message. If logging an error, the type of the exception would go into type but you can put anything in there, that makes sense for your domain.
- url string? - If message relates to a HTTP request, you may send the URL of that request. If you don't provide us with an URL, we will try to find a key named URL in serverVariables.
- user string? - An identification of the user triggering this message. You can put the users email address or your user key into this property.
- 'version string? - Versions can be used to distinguish messages from different versions of your software. The value of version can be a SemVer compliant string or any other syntax that you are using as your version numbering scheme.
elmah: MessageOverview![](/images/permalink.svg)
Message overview.
Fields
- application string? - Used to identify which application logged this message. You can use this if you have multiple applications and services logging to the same log
- breadcrumbs Breadcrumb[]? - A list of breadcrumbs preceding this log message.
- code string? - Code can be used to include source code related to the log message. The code will typically span from a few lines before the line causing the log message to a few lines after. For now, all lines above 21 will be removed. This makes room for showing 10 lines before the logging line, the logging line, and 10 lines after the logging line. Don't include a very large string in this property since that will quickly make the entire messages exceed the max limit of 256 kb.
- cookies Item[]? - A key/value pair of cookies. This property only makes sense for logging messages related to web requests.
- correlationId string? - CorrelationId can be used to group similar log messages together into a single discoverable batch. A correlation ID could be a session ID from ASP.NET Core, a unique string spanning multiple microsservices handling the same request, or similar.
- data Item[]? - A key/value pair of user-defined fields and their values. When logging an exception, the Data dictionary of the exception is copied to this property. You can add additional key/value pairs, by modifying the Data dictionary on the exception or by supplying additional key/values to this API.
- dateTime string? - The date and time in UTC of the message. If you don't provide us with a value in dateTime, we will set the current date and time in UTC.
- detail string? - A longer description of the message. For errors this could be a stacktrace, but it's really up to you what to log in there.
- form Item[]? - A key/value pair of form fields and their values. This property makes sense if logging message related to users inputting data in a form.
- hostname string? - The hostname of the server logging the message.
- id string? - The ID of this message.
- method string? - If message relates to a HTTP request, you may send the HTTP method of that request. If you don't provide us with a method, we will try to find a key named REQUEST_METHOD in serverVariables.
- queryString Item[]? - A key/value pair of query string parameters. This property makes sense if logging message related to a HTTP request.
- serverVariables Item[]? - A key/value pair of server values. Server variables are typically related to handling requests in a webserver but could be used for other types of information as well.
- severity string? - An enum value representing the severity of this message. The following values are allowed: Verbose, Debug, Information, Warning, Error, Fatal
- 'source string? - The source of the code logging the message. This could be the assembly name.
- statusCode int? - If the message logged relates to a HTTP status code, you can put the code in this property. This would probably only be relevant for errors, but could be used for logging successful status codes as well.
- title string? - The textual title or headline of the message to log.
- titleTemplate string? - The title template of the message to log. This property can be used from logging frameworks that supports structured logging like: "{user} says {quote}". In the example, titleTemplate will be this string and title will be "Gilfoyle says It's not magic. It's talent and sweat".
- 'type string? - The type of message. If logging an error, the type of the exception would go into type but you can put anything in there, that makes sense for your domain.
- url string? - If message relates to a HTTP request, you may send the URL of that request. If you don't provide us with an URL, we will try to find a key named URL in serverVariables.
- user string? - An identification of the user triggering this message. You can put the users email address or your user key into this property.
- 'version string? - Versions can be used to distinguish messages from different versions of your software. The value of version can be a SemVer compliant string or any other syntax that you are using as your version numbering scheme.
elmah: MessagesResult![](/images/permalink.svg)
Message summary.
Fields
- messages MessageOverview[]? - Log messages.
- total int? - The total number of log messages found.
elmah: ProxyConfig![](/images/permalink.svg)
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
elmah: Search![](/images/permalink.svg)
Search properties.
Fields
- 'from string? - Search from this date.
- query string? - Lucene query.
- to string? - Search to this date.
elmah: UptimeCheck![](/images/permalink.svg)
Uptime check.
Fields
- id string? - ID of the uptime check.
- name string? - Name of the uptime check.
- status string? - Current status of the uptime check.
- url string? - Url of the uptime check.
Import
import ballerinax/elmah;
Metadata
Released date: over 1 year ago
Version: 1.5.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 2
Current verison: 0
Weekly downloads
Keywords
IT Operations/Debug Tools
Cost/Paid
Contributors
Dependencies