Hi im having a lot of troubles making the migration from version 4 to 5, so my problem right nows its with the HTTP api, really in version 5 there are not any documentation only one table with some path but anything that could tell if the end points are correct or anything.
So assuming that they mantain some paths i have updated the port and api version like this:
OLD:
:8081/api/v4/resources
NEW:
18083/api/v5/resources
the old code for detecting correct response
//create resources
async function createControlResource() {
try {
const url = "http://" + process.env.EMQX_API_HOST + ":" + process.env.EMQX_API_PORT + "/api/" + process.env.EMQX_API_VERSION + "/resources";
const data1 = {
"type": "web_hook",
"config": {
url: "http://" + process.env.WEBHOOKS_HOST + ":3001/api/control-webhook",
headers: {
token: process.env.EMQX_API_TOKEN
},
method: "POST"
},
description: "control-webhook"
}
const res1 = await axios.post(url, data1, auth);
if (res1.status === 200) {
console.log("Control resource created!".green);
}
setTimeout(() => {
console.log("***** Emqx WH resources created! :) *****".green);
listResources();
}, 1000);
} catch (error) {
console.log("Error creating resources");
console.log(error);
}
}
new code… still trying to understand how to change it.