Managed Backup API Specification

Managed Backup enables interaction with backend features using the API. The API provides a set of requests that can be incorporated into user automation workflow or various remote management solutions (for example, ConnectWise).

This chapter covers the following topics:

  • API Credentials
  • Generating an Access Token
  • HTTPS Requests via MBS API
  • Test API Requests

API Credentials

To start using API, generate API credentials on Setting > General. Save generated API Credentials somewhere. In further, these credentials will be used for the initial token generation.

Note: if you change existing API credentials, old ones expire automatically. Consider, changed API Credentials should also be used for PowerShell Module

Once credentials are generated, proceed to request the initial authentication token which will be used for authentication in HTTPS requests to Managed Backup services.

Access Token

To request a token, send a POST request with the API credentials. Requests syntax along with the description of all the available commands is available at https://api.mspbackups.com.

The base URL for all requests is https://api.mspbackups.com. Once a request is sent, the api.mspbackups.com URL is appended by a string that reflects the purpose of the request.

  1. Request a token by sending the following request:
POST api/Provider/Login

Learn more about this method in the POST API/Provider/Login chapter of the Methods section.

  1. Copy the address, then add it to the base URL.
  2. Create and send the request.

  1. The first argument in the method is always the request URL that consists of the base URL and the text copied on steps 1 and 2.
  2. The second argument is JSON which contains the API credentials.

  1. Once executed, the request will be sent. The response is another JSON containing the token.
  2. The access is ready. Mind that token expires every two weeks after generation. Keep the token in a safe place.

HTTPS Requests via MBS API

To Send GET Request that Returns All Users List

The study request should contain the following information in headers:

  • "Authorization" : "Bearer access token"
  • "Accept" : "application/json"

Once you sent the request, make sure that received JSON contains the correct values

Other requests imply the same approach. To learn more, refer to the Methods section.

To Create a User

print ("Creating new user...")

newuser = {
"Email" : "testuser", #required 
"Enabled" : True, #required
"Password" : "yourpassword", # required
}

#send request to create a new user
createUserRequest = requests.post('https://api.mspbackups.com/api/Users/', json = newUser, headers = { "Accept" : "application/json", "Authorization" : "Bearer Fcqjl3556y7hgh", 
print(createUserRequest.json()) #display new user ID


updateUser = {
"ID" : "192879d1-f4ea-4665-a1ea-7e2c1a6ac44a",
"Enabled" : True,
"Password" : "updatedpassword" #modified password 
}	

Once the code is executed, the ID of the new user is returned:

To learn more about API methods, refer to the Methods section.

Note: Managed Backup restricts the number of requests by 1000 per minute

Test API Requests

You can create test API requests using the Swagger tool.

The Swagger is located at https://api.mspbackups.com/Swagger/

Be aware that the link to Swagger is case-sensitive and must always be as follows: https://api.mspbackups.com/Swagger/

To learn more about Swagger, refer to the https://swagger.io/ resource

https://git.cloudberrylab.com/egor.m/doc-help-mbs.git