New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apihawk/acronis-sdk

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apihawk/acronis-sdk

Acronis REST API client

2.0.2
latest
npm
Version published
Maintainers
4
Created
Source

Acronis REST API client for Node.js

How to Install

$ npm i @apihawk-private/acronis-sdk

Prerequisites

In order to use this library (and the REST API on its own), you must have a registered client application in Acronis Cloud. You need to obtain the API client ID and API client secret key for that application and provide them in the constructor.

How to register a client application

You must have an administrator account in Acronis Cloud. You will need its username and password in order to authenticate for this endpoint.

Headers:

> POST /api/2/clients HTTP/1.1
> Host: eu2-cloud.acronis.com
> Content-Type: application/json
> Authorization: Basic base64(admin_username:admin_password)
> Accept: application/json

Body:

{
  "type": "agent",
  "tenant_id": "<YOUR_TENANT_ID>",
  "token_endpoint_auth_method": "client_secret_basic",
  "data": {
    "name": "Billia",
    "company": "Apihawk"
  }
}

Response:

{
  "tenant_id": "<TENANT_ID>",
  "client_id": "<CLIENT_ID>", // save this
  "client_secret": "<CLIENT_SECRET>", // save this
  "data": {
    "name": "Billia",
    "company": "Apihawk"
  },
  "token_endpoint_auth_method": "client_secret_basic",
  "type": "agent",
  "client_secret_expires_at": 0,
  "registration_access_token": "<SECRET>"
}

Example

Basic example:

import { AcronisClient } from '@apihawk-private/acronis-sdk';

// initialize the SDK
const acronis = new AcronisClient({
  api: 'https://eu2-cloud.acronis.com/api/2'
  clientId: '<your_client_id>',
  clientSecret: '<your_client_secret>'
});

// authenticate yourself with the Acronis API server
await acronis.authorize();

// you can now call methods which require authorization
const users = await acronis.User.getUsers();
const tenant = await acronis.Tenant.getTenantById('<tenant ID>');

You can run the example scripts which are located in the /examples folder in the following way:

$ npx ts-node examples/provision.ts

You need to provide the following environmental variables:

export ACRONIS_API=https://eu2-cloud.acronis.com/api/2
export ACRONIS_CLIENT_ID=<YOUR_CLIENT_ID>
export ACRONIS_CLIENT_SECRET=<YOUR_CLIENT_SECRET>

Please use a test/demo account!

Test

You can run the integration tests:

$ npm test

Logging

You can turn on HTTP requests logging by setting the DEBUG environmental variable:

export DEBUG=acronis-sdk*

Resources

It's strongly advised to get familiar with the Acronis REST API before using this library.

  • https://developer.acronis.com/doc/platform/management/v2/

Keywords

Acronis

FAQs

Package last updated on 25 Jan 2023

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