Coder Social home page Coder Social logo

mongodb-developer / atlas-admin-api-digest-auth Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 0.0 109 KB

Demonstration of calling the MongoDB Atlas Administration API using digest authentication

Home Page: https://www.mongodb.com/developer/how-to/nodejs-python-ruby-atlas-api/

License: Apache License 2.0

JavaScript 45.59% Python 31.27% Ruby 23.14%
atlas digest-authentication mongodb mongodb-atlas

atlas-admin-api-digest-auth's Introduction

MongoDB Atlas Administration API โ€” Digest Authentication Demo

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.

Setup

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>

Usage

The repository includes request examples for Python, Node.js and Ruby.

Python Example

To run the Python example, execute:

cd python
pip install -r requirements.txt
python ./request.py

Node.js Example

To run the Node.js example, execute:

cd node
npm install
node ./request.js

Ruby Example

To run the Ruby example, execute:

cd ruby
bundle install
ruby ./request.rb

If you don't have Bundler, you can install the httparty gem manually:

cd ruby
gem install httparty
ruby ./request.rb

Tests

The 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.

Python Test

To run the Python test, execute:

cd python
pip install -r requirements.txt
python -m unittest

Node.js Test

To run the Node.js test, execute:

cd node
npm install
npm test

Ruby Test

To run the Ruby test, execute:

cd ruby
bundle install
ruby test_request.rb

Disclaimer

Use at your own risk; not a supported MongoDB product

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.