npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

app-services-admin-sdk-generated

v0.1.0

Published

A generated SDK for AtlasAppServicesAPI.

Downloads

3

Readme

Atlas App client library for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Atlas App client.

App Services provides an API for programmatically performing administrative tasks outside of the App Services UI. This includes tasks such as modifying authentication providers, creating rules, and defining functions. Client applications should not use the admin API. Instead, use one of the Client SDKs for tasks like authenticating users, calling functions, and interacting with services.

Project & Application IDs

Note: The terms Project ID and Group ID are interchangeable.

App Services APIs frequently require two parameters: your Atlas Project/Group ID, and your App Services Application ID.

Project ID

You can find your Project ID from the MongoDB Atlas dashboard or CLI.

Application ID

To find an Application ID, make a request to the App Services GET /groups/{groupid}/apps API endpoint.

This request has the following format, referencing the access_token and the Group ID:

curl --request GET \
  --header 'Authorization: Bearer <access_token>' \
  https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps

This will return a list of objects describing each Atlas App Services app in the provided group. For Admin API requests, your Application ID is the ObjectId value in the _id field, not the client_app_id.

[
  {
    "_id": "5997529e46224c6e42gb6dd9",
    "group_id": "57879f6cc4b32dbe440bb8c5",
    "domain_id": "5886619e46124e4c42fb5dd8",
    "client_app_id": "myapp-abcde",
    "name": "myapp",
    "location": "US-VA",
    "deployment_model": "GLOBAL",
    "last_used": 1615153544,
    "last_modified": 0,
    "product": "standard",
    "environment": ""
  }
]

Get Authentication Tokens

Every request to the App Services Admin API must include a valid and current authorization token from the MongoDB Cloud API as a bearer token in the Authorization header. You will need a valid programmatic API key for MongoDB Atlas to get a token.

Once you have an API key pair, call the authentication endpoint:

curl --request POST \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data '{"username": "<Public API Key>", "apiKey": "<Private API Key>"}' \
  https://realm.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login

If authentication succeeds, App Services returns an access token as part of the JSON response document:

{
  "access_token": "<access_token>",
  "refresh_token": "<refresh_token>",
  "user_id": "<user_id>",
  "device_id": "<device_id>"
}

The access_token represents a limited-time authorization to interact with the Admin API. To authenticate a request, include the token in a Bearer token Authorization header.

Authorization: Bearer <access_token>

Package (NPM) | Samples

Getting started

Currently supported environments

See our support policy for more details.

Install the app-services-admin-sdk-generated package

Install the Atlas App client library for JavaScript with npm:

npm install app-services-admin-sdk-generated

JavaScript Bundle

To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our bundling documentation.

Key concepts

AtlasAppServicesAPI

AtlasAppServicesAPI is the primary interface for developers using the Atlas App client library. Explore the methods on this client object to understand the different features of the Atlas App service that you can access.