Action
Create post in Oregano
Posted by @aTylerRobertson,
Last update
about 4 years ago
- Unlisted
Publish draft to my Glitch-hosted Oregano blog
Steps
-
script
// This value can be any string, and is used in Settings > Credentials const siteID = "My-Blog";
-
script
// Authorize credentials var credential = Credential.create(siteID, "Paste your site's /write URL, and your secret key from .env"); credential.addURLField("siteURL", "URL"); credential.addPasswordField("key", "Secret Key") if (credential.authorize()) { const siteURL = credential.getValue("siteURL"); const key = credential.getValue("key"); var data = { "markdown": draft.content, "key": key } // create HTTP and make POST request to Catch Hook var http = HTTP.create(); var response = http.request({ "url": siteURL, "method": "POST", "data": data, "headers": { "Accept": "application/json" } }); // log result console.log("HTTP Status: " + response.statusCode); console.log("HTTP Response: " + response.responseText); if (response.statusCode != 200) { context.fail(); } else { console.log("Draft published!"); } } else { context.cancel(); }
Options
-
After Success Archive , Tags: published Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.