Load Balance
Load balance across acounts at /loadBalancer/:route
Imagine
Send a request to load balancing in the same way as Imagine, but using /loadBalancer/imagine
.
Buttons
Send a request to load balancing in the same way as Buttons using /loadBalancer/button
Add loadBalanceId
from previous request to body.
Additional properties
- Name
loadBalanceId
- Type
- string
- Description
The Load Balance ID
POST/loadBalancer/button
Example Button
Request
POST
/loadBalancer/buttonvar myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {any-token}");
var raw = JSON.stringify({
"button": "U1",
"buttonMessageId": "button-message-id",
"loadBalanceId": "load-balance-id"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.justimagineapi.org/loadBalancer/button", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Response
{
"messageId": "message-id",
"loadBalanceId": "load-balance-id",
"accountId": "account-id",
}
GET/loadBalancer/message/:messageId?loadBalanceId=loadBalanceId
Example Get Message
Get a message in same way as normal, except using loadBalanceId
as parameter
Request
POST
/loadBalancer/message/:messageId?loadBalanceId=loadBalanceIdvar myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {token}");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.justimagineapi.org/loadBalancer/message/:messageId?loadBalanceId=loadBalanceId", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));