cURL
1
2
3
4
5
6
7
8
9
10
11
12curl -X POST "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions" \
-H "Authorization: Bearer $INOVACC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}'
curl -X POST "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions" \
-H "Authorization: Bearer $INOVACC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}'
TypeScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22const body: Record<string, unknown> = {
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
};
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INOVACC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(response.status, await response.text());
const body: Record<string, unknown> = {
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
};
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INOVACC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(response.status, await response.text());
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27import json
import os
import urllib.request
body = {
"types": [
"order.*",
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc",
},
}
request = urllib.request.Request(
"https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions",
data=json.dumps(body).encode(),
method="POST",
headers={
"User-Agent": "inovacc-python-sample",
"Authorization": "Bearer " + os.environ["INOVACC_API_KEY"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request) as response:
print(response.status, response.read().decode())
import json
import os
import urllib.request
body = {
"types": [
"order.*",
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc",
},
}
request = urllib.request.Request(
"https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions",
data=json.dumps(body).encode(),
method="POST",
headers={
"User-Agent": "inovacc-python-sample",
"Authorization": "Bearer " + os.environ["INOVACC_API_KEY"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request) as response:
print(response.status, response.read().decode())
Go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"
const body = `{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}`
func main() {
req, err := http.NewRequest("POST", url, strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("INOVACC_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"
const body = `{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}`
func main() {
req, err := http.NewRequest("POST", url, strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("INOVACC_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}
Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
// Cargo.toml: serde_json = "1"
fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("INOVACC_API_KEY")?;
let body = serde_json::json!({
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
});
let response = reqwest::blocking::Client::new()
.post("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions")
.bearer_auth(api_key)
.json(&body)
.send()?;
println!("{} {}", response.status(), response.text()?);
Ok(())
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
// Cargo.toml: serde_json = "1"
fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("INOVACC_API_KEY")?;
let body = serde_json::json!({
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
});
let response = reqwest::blocking::Client::new()
.post("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions")
.bearer_auth(api_key)
.json(&body)
.send()?;
println!("{} {}", response.status(), response.text()?);
Ok(())
}
JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22const body = {
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
};
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INOVACC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(response.status, await response.text());
const body = {
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
};
const url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INOVACC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(response.status, await response.text());
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28<?php
$body = <<<'JSON'
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
JSON;
$curl = curl_init('https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('INOVACC_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$response = curl_exec($curl);
echo curl_getinfo($curl, CURLINFO_HTTP_CODE), ' ', $response, "\n";
curl_close($curl);
<?php
$body = <<<'JSON'
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
JSON;
$curl = curl_init('https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('INOVACC_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$response = curl_exec($curl);
echo curl_getinfo($curl, CURLINFO_HTTP_CODE), ' ', $response, "\n";
curl_close($curl);
Ruby
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26require "net/http"
require "uri"
uri = URI('https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions')
body = <<~'JSON'
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
JSON
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('INOVACC_API_KEY')}"
request["Content-Type"] = "application/json"
request.body = body
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"
require "net/http"
require "uri"
uri = URI('https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions')
body = <<~'JSON'
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
JSON
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('INOVACC_API_KEY')}"
request["Content-Type"] = "application/json"
request.body = body
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("INOVACC_API_KEY");
String body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("INOVACC_API_KEY");
String body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22using System.Text;
var body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}";
var url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
var apiKey = Environment.GetEnvironmentVariable("INOVACC_API_KEY");
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Add("Authorization", $"Bearer {apiKey}");
request.Content = new StringContent(body, Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
using System.Text;
var body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}";
var url = "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions";
var apiKey = Environment.GetEnvironmentVariable("INOVACC_API_KEY");
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Add("Authorization", $"Bearer {apiKey}");
request.Content = new StringContent(body, Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
Kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val apiKey = System.getenv("INOVACC_API_KEY")
val body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}"
val request = HttpRequest.newBuilder()
.uri(URI.create("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build()
val response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString())
println("${response.statusCode()} ${response.body()}")
}
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val apiKey = System.getenv("INOVACC_API_KEY")
val body = "{" +
"\"types\": [" +
"\"order.*\"" +
"]," +
"\"delivery\": {" +
"\"mode\": \"webhook\"," +
"\"url\": \"https://hooks.example.com/inovacc\"" +
"}" +
"}"
val request = HttpRequest.newBuilder()
.uri(URI.create("https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build()
val response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString())
println("${response.statusCode()} ${response.body()}")
}
Swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
let body = #"""
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
"""#
let apiKey = ProcessInfo.processInfo.environment["INOVACC_API_KEY"] ?? ""
let url = URL(string: "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = Data(body.utf8)
let (data, response) = try await URLSession.shared.data(for: request)
let status = (response as? HTTPURLResponse)?.statusCode ?? 0
print(status, String(decoding: data, as: UTF8.self))
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
let body = #"""
{
"types": [
"order.*"
],
"delivery": {
"mode": "webhook",
"url": "https://hooks.example.com/inovacc"
}
}
"""#
let apiKey = ProcessInfo.processInfo.environment["INOVACC_API_KEY"] ?? ""
let url = URL(string: "https://events.inovacc.dev/v1/workspaces/{workspace_id}/subscriptions")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = Data(body.utf8)
let (data, response) = try await URLSession.shared.data(for: request)
let status = (response as? HTTPURLResponse)?.statusCode ?? 0
print(status, String(decoding: data, as: UTF8.self))