const axios = require('axios');
const url = "https://resource-cmd.api.pinghome.io/v1/resource";
const data = {
"name": "Pinghome",
"type": "http",
"port": "",
"data": "",
"grace_period": 0,
"recovery_period": 0,
"maintenance_cron_expression": "*/8 * * * *",
"maintenance_duration": 5,
"skip_ssl_error": false,
"not_follow_redirect": false,
"method": "POST",
"body": "param1=value1¶m2=value2",
"is_advanced": true,
"headers": { "Authorization": "Bearer sometoken" },
"service_id": "14ab74bf-87a0-4565-a291-ad5c9733c53f",
"url": "https://website-stage.ping-home.com",
"conditions": [{
"values": ["pinghome"],
"operator": "equal",
"type": "response-json-check",
"key": "groups.user[0].name"
}],
"regions": ["eu-central-1"]
};
axios.post(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});