This repository demonstrates how to call the MongoDB Atlas Administration API using digest authentication. You can read the accompanying article 'Calling the MongoDB Atlas Admin API - How to do it from Node, Python, and Ruby' for more information.
To connect to the Atlas Administration API, you need to generate an organization API key. Make sure you add your IP address in the API access list!
Then, export the following environment variables, where ATLAS_USER is your public key and ATLAS_USER_KEY is your private key.
export ATLAS_USER=<public_key>
export ATLAS_USER_KEY=<private_key>The repository includes request examples for Python, Node.js and Ruby.
To run the Python example, execute:
cd python
pip install -r requirements.txt
python ./request.pyTo run the Node.js example, execute:
cd node
npm install
node ./request.jsTo run the Ruby example, execute:
cd ruby
bundle install
ruby ./request.rbIf you don't have Bundler, you can install the httparty gem manually:
cd ruby
gem install httparty
ruby ./request.rbThe repo includes a naive unit test for each of the examples. The tests execute the request and check the standard output for the expected success message.
To run the Python test, execute:
cd python
pip install -r requirements.txt
python -m unittestTo run the Node.js test, execute:
cd node
npm install
npm testTo run the Ruby test, execute:
cd ruby
bundle install
ruby test_request.rbUse at your own risk; not a supported MongoDB product