Create event
POST/events
Create an external event
The event will be processed asynchronously and the response will be returned immediately.
In order to send the event, the request must contain the following headers:
- X-Api-Key: The API key to identify the caller
- X-Signature: The HMAC signature of the request body
The HMAC signature is generated by hashing the request body with the given secret key. Ask the administrator for the secret key.
Here are examples of how to generate the HMAC signature
In Go:
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func generateHMAC(secret, body string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(body))
return hex.EncodeToString(mac.Sum(nil))
}
In Python:
import hmac
import hashlib
def generate_hmac(secret, body):
return hmac.new(secret.encode(), body.encode(), hashlib.sha256).hexdigest()
In Node.js:
const crypto = require('crypto');
function generateHMAC(secret, body) {
return crypto.createHmac('sha256', secret).update(body).digest('hex');
}
In Ruby:
require 'openssl'
def generate_hmac(secret, body)
OpenSSL::HMAC.hexdigest('SHA256', secret, body)
end
In Java:
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
public class HMACGenerator {
public static String generateHMAC(String secret, String body) {
try {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
mac.init(secretKeySpec);
byte[] hash = mac.doFinal(body.getBytes());
return new String(hash);
} catch (Exception e) {
e.printStackTrace();
return null;
}
Request
Responses
- 204
- 400
- 401
- 409
- 422
- 500
No Content
Response Headers
Access-Control-Allow-Headers
Access-Control-Allow-Methods
Access-Control-Allow-Origin
Cache-Control
Content-Type
Bad Request
Unauthorized
Conflict
Unprocessable Entity
Internal Server Error