-Managing DXO Connection Information for cURL

This blog post provides instructions to use environment variables to designate a Conscia DXO Engine API endpoint API for cURL commands and a configuration file to store the Conscia Customer Code and API Token used for connections. I will use this to shorten my cURL examples, to make them less repetitive, and to make them more portable.

Update 15.Dec.2025: After years of frustration with WordPress, I am finally abandoning this blog. The content will likely stay here for some time, but new content will appear here:

DXO API Endpoint Environment Variables

I define two environment variables that configure DXO API endpoints.

  • DXG_HOST: The DX Graph host.
  • DXG_BASE: The DX Graph Webservice API endpoint base.
  • DXE_HOST: The DX Engine host.
  • DXE_BASE: The DX Engine Webservice API endpoint base.

I work almost exclusively ins staging, so I set these in my ~/.bashrc file.

export DXG_HOST=io-staging.conscia.ai
export DXG_BASE=https://$DXG_HOST/vue/_api/v1
export DXE_HOST=engine-staging.conscia.ai
export DXE_BASE=https://$DXE_HOST/api

For other Conscia infrastructure endpoints, see:

I put my Customer Code and API Token in ~/bin/.dxcurlrc. It seemed to require double-quotes around the values.

-H "X-Customer-Code: {customer-code}"
-H "Authorization: Bearer {token}"

Now I can significantly shorten my cURL commands and make them more portable:

curl -X GET -K ~/bin/.dxcurlrc $DXE_BASE/{api-path}

To use such command lines without a configuration file or environment variables, replace -K ~/bin/.dxcurlrc and $DXE_BASE.

curl -X GET -H "X-Customer-Code: {customer-code}" -H "Authorization: Bearer {token}" {api-base}/{api-path}

Passing Data from Files to APIs

You can use the -d parameter to pass a JSON body from the command line to a Webservice API. Remember to include -H ‘Content-type: application/json’ in this case.

You can use –data to pass the contents of a file. Remember to use the @ prefix.

curl -X PUT -K ~/bin/.dxcurlrc -H 'Content-type: application/json' --data '@{path-to-file}' $DXE_BASE/{api-path}

One thought on “-Managing DXO Connection Information for cURL

Leave a comment