Best answer

What is the "z" variable?

  • 17 January 2023
  • 2 replies

Badge +1

What is the z variable that is injected into many of the CLI-applications’ methods?  For example:

Is there any documentation? 

In particular, I’d like to know if the z.request method supports POSTing a SSL certificate and key.


Best answer by shalgrim 17 January 2023, 20:53

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 6
Badge +8

Hey Benjamin,

We document the z object here. You can definitely send POST requests, but I don’t know for sure about the SSL cert and key. You might need to play around to find out.

Let us know if you have any more questions!

Badge +1

Thanks for the response and the reference.

I don’t see any request options that would allow me to provide these files.

I’m trying to do this (node):

const https = require('https')
const querystring = require('querystring')

const options = {
cert: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n",
key: "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n",
host: '',
path: '/auth/oauth/v2/token',
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}

const requestData = {
grant_type: 'client_credentials',
client_id: 'REDACTED',
client_secret: 'REDACTED',

const requestBody = querystring.stringify(requestData);

const req = https.request(options, (res) => {
let response = ''

console.log('Status Code:', res.statusCode);

res.on('data', (chunk) => {
response += chunk
res.on('end', ()=>{
console.log('Body: ', JSON.parse(response));
}).on("error", (err) => {
console.error("Error: ", err.message);


Can this be done with your z object natively?