Cloudflare (API key)

CDN, DDoS mitigation, Internet security, and DNS services

Go to site

Integrate the Cloudflare (API key) API with the MongoDB API

Setup the Cloudflare (API key) API trigger to run a workflow which integrates with the MongoDB API. Pipedream's integration platform allows you to integrate Cloudflare (API key) and MongoDB remarkably fast. Free for developers.

Insert a document into a collection
 
Try it
Create DNS Record

Creates a DNS Record given its zone id

 
Try it
Purge All Files

Remove ALL files from Cloudflare's cache.

 
Try it
Purge Files By Url

Removes one or more files from Cloudflare's cache either by specifying URLs.

 
Try it
Update DNS record

Updates a DNS Record given its zone id

 
Try it

Connect Cloudflare (API key)

return await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.cloudflare.com/client/v4/user`,
  headers: {
    "X-Auth-Key": `${auths.cloudflare_api_key.API_Key}`,
    "X-Auth-Email": `${auths.cloudflare_api_key.Email}`,
  },
})

Connect MongoDB

const MongoClient = require('mongodb').MongoClient

const {
  database,
  hostname,
  username,
  password,
} = auths.mongodb

const url = `mongodb+srv://${username}:${password}@${hostname}/test?retryWrites=true&w=majority`
const client = await MongoClient.connect(url, { 
  useNewUrlParser: true, 
  useUnifiedTopology: true 
})

const db = client.db(database)
// Enter your target collection as a parameter to this step
this.res = await db.collection(params.collection).insertOne({ name: "Luke Skywalker" })

await client.close()