Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

microsoft-partnercenter

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microsoft-partnercenter

## Getting Started

  • 6.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
244
increased by101.65%
Maintainers
0
Weekly downloads
 
Created
Source

Microsoft PartnerCenter and Graph API SDK for NodeJS

Getting Started

You can install the package with the following command:

npm install microsoft-partnercenter

or

yarn add microsoft-partnercenter

or

pnpm install microsoft-partnercenter

Partner Center API

Initialize with Client ID and Client Secret Auth & Partner Domain:

import { MicrosoftPartnerCenter } from "microsoft-partnercenter"

const msPartnerCenter = new MicrosoftPartnerCenter({
  partnerDomain: "partner.onmicrosoft.com",
  authentication: {
    clientId: "1",
    clientSecret: "1",
  },
})

Graph API

Initialize with Client ID, Client Secret, and Tenant ID:

import { MicrosoftGraphApi } from "microsoft-partnercenter"

const msGraphApi = new MicrosoftGraphApi({
  tenantId: "your-tenant-id",
  authentication: {
    clientId: "1",
    clientSecret: "1",
  },
})

Example Usage

Partner Center API

Get all Customers
await msPartnerCenter.getAllCustomers()
Create Order
const customerId = "123"
const billingCycle = "monthly"

const lineItems = [
  {
    offerId: "1",
    quantity: 16,
    termDuration: "P1M",
  },
]

await msPartnerCenter.createOrder(customerId, billingCycle, lineItems)

Graph API

Create a GDAP Relationship
const relationship = await msGraphApi.createGDAPRelationship({
  displayName: "My GDAP Relationship",
  partner: {
    tenantId: "partner-tenant-id",
  },
  customer: {
    tenantId: "customer-tenant-id",
  },
  accessDetails: {
    unifiedRoles: ["Directory Readers"],
  },
  duration: "P90D",
})
Get All GDAP Relationships
const relationships = await msGraphApi.getAllGDAPRelationships()
Create a Domain
const domain = await msGraphApi.createDomain("example.com")
Get All Domains
const domains = await msGraphApi.getAllDomains()

Authentication

Both the Partner Center API and Graph API support authentication using client credentials (client ID and client secret). The SDK handles token management and renewal automatically.

Error Handling

The SDK includes built-in error handling and will automatically retry on certain errors (e.g., 401 Unauthorized). You can configure retry behavior in the config object:

const msPartnerCenter = new MicrosoftPartnerCenter({
  // ... other config
  conflict: {
    retryOnConflict: true,
    retryOnConflictDelayMs: 1000,
    maximumRetries: 3,
  },
})

Documentation

For more detailed information about available methods and their parameters, please refer to the TypeScript definitions included with this package.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request

Keywords

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc