AsyncAPI Sample v1.0.0
Scroll down for code samples, example headers and payloads. Select a language for code samples from the tabs above or the mobile navigation menu.
This is a simple example of an AsyncAPI document.
Base URLs:
-
mqtt://api.company.com:{port}/{app-id}
-
app-id - You can find your
app-id
in our control panel, under the auth tab. Default: demo -
port - Default: 5676
- 5676
- 5677
-
Base Topic: hitch
user
accounts.1.0.action.user.signup
publish
Note: Deprecated
Example headers
{
"qos": 1,
"retainFlag": false
}
Example payload
{
"user": {
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
}
Code Samples
const hermes = require('hermesjs');
const app = hermes();
app.from.client.send({
topic: 'accounts.1.0.action.user.signup',
payload: {
"user": {
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
}
});
//Coming soon...
# Coming soon...
//Coming soon...
/* asyncapi-java-tools */
try (JmsServer client = builder.build()) {
client.accounts.1.0.action.user.signup()
.publish({
"user": {
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
})
.toCompletableFuture()
.get();
}
//Coming soon...
Action to sign a user up.
Multiline description of what this action does. It allows Markdown.
Headers
Properties
Name | Type | Required | Description |
---|---|---|---|
qos | integer | false | Quality of Service |
retainFlag | boolean | false | This flag determines if the message will be saved by the broker for the specified topic as last known good value. New clients that subscribe to that topic will receive the last retained message on that topic instantly after subscribing. More on retained messages and best practices in one of the next posts. |
Payload
Properties
Name | Type | Required | Description |
---|---|---|---|
user | object | false | No description |
full_name | string | false | User full name |
username | string | true | User handle |
signup | object | false | No description |
method | string | true | Signup method |
datetime | string | true | Date and Time of the message |
Default
accounts.1.0.event.user.signup
subscribe
Example payload
{
"user": {
"id": "string",
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
}
Code Samples
const hermes = require('hermesjs');
const app = hermes();
app.from.client.send({
topic: 'accounts.1.0.event.user.signup',
payload: {
"user": {
"id": "string",
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
}
});
//Coming soon...
# Coming soon...
//Coming soon...
/* asyncapi-java-tools */
try (JmsServer client = builder.build()) {
client.accounts.1.0.event.user.signup()
.publish({
"user": {
"id": "string",
"full_name": "string",
"username": "string"
},
"signup": {
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
})
.toCompletableFuture()
.get();
}
//Coming soon...
Payload
Properties
Name | Type | Required | Description |
---|---|---|---|
user | object | false | No description |
id | string | true | Resource identifier |
full_name | string | false | User full name |
username | string | true | User handle |
signup | object | false | No description |
method | string | true | Signup method |
datetime | string | true | Date and Time of the message |
Schemas
id
"string"
Properties
Name | Type | Required | Description |
---|---|---|---|
id | id | false | Resource identifier |
username
"string"
Properties
Name | Type | Required | Description |
---|---|---|---|
username | username | false | User handle |
datetime
"2018-04-03T07:32:55Z"
Properties
Name | Type | Required | Description |
---|---|---|---|
datetime | datetime(date-time) | false | Date and Time of the message |
MQTTQoSHeader
1
Properties
Name | Type | Required | Description |
---|---|---|---|
qos | MQTTQoSHeader(int32) | false | Quality of Service |
Enumerated Values
Property | Value |
---|---|
qos | 0 |
qos | 2 |
MQTTRetainHeader
false
Properties
Name | Type | Required | Description |
---|---|---|---|
retainFlag | MQTTRetainHeader | false | This flag determines if the message will be saved by the broker for the specified topic as last known good value. New clients that subscribe to that topic will receive the last retained message on that topic instantly after subscribing. More on retained messages and best practices in one of the next posts. |
user
{
"id": "string",
"full_name": "string",
"username": "string"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
» id | id | true | Resource identifier |
» full_name | string | false | User full name |
» username | username | true | User handle |
userCreate
{
"full_name": "string",
"username": "string"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
» full_name | string | false | User full name |
» username | username | true | User handle |
signup
{
"method": "email",
"datetime": "2018-04-03T07:32:55Z"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
» method | string | true | Signup method |
» datetime | datetime(date-time) | true | Date and Time of the message |
Enumerated Values
Property | Value |
---|---|
method | |
method | |
method | |
method | github |
method |