import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
knack: {
type: "app",
app: "knack",
}
},
async run({steps, $}) {
return await axios($, {
method: "post",
url: `https://api.knack.com/v1/objects/object_1/records`,
headers: {
"X-Knack-Application-Id": `${this.knack.$auth.application_id}`,
"X-Knack-REST-API-KEY": `${this.knack.$auth.api_key}`,
"content-type": `application/json`,
},
})
},
})
Knack uses API keys for authentication. When you connect your Knack account, Pipedream securely stores the keys so you can easily authenticate to Knack APIs in both code and no-code steps.
Object-based requests require at least two headers: an application ID - to identify to our servers the app whose records you are requesting - and an API key (which is specific to each app) to authenticate the request. See docs.