Page tree
Skip to end of metadata
Go to start of metadata

This document describes how to configure, connect to, and interact with the Reseller API. The Reseller API is available to all resellers, and offers the ability to provision and manage Blesta licenses.

Interested in becoming a reseller?

For more information on becoming a reseller visit http://www.blesta.com/resellers/.

Overview

The Reseller API is a RESTful service. All data is returned in JSON format. The API is located at:

https://account.blesta.com/plugin/blesta_reseller/v2/index/

Authentication

The API supports Basic Access Authentication. All requests must be made over HTTPS.

Example Request

Errors

There are several types of errors that may be encountered when working with the API:

  1. Sending invalid parameters will result in a 400 Bad Request response.

    HTTP/1.1 400 Bad Request
    Content-Length: 137
    
    {
     "message":"The request cannot be fulfilled due to bad syntax.",
     "errors":
     {
      "field":
      {
       "code":"Error message."
      }
     }
    }
  2. Providing invalid credentials will result in a 401 Unauthorized response.

    HTTP/1.1 401 Unauthorized
    Content-Length: 67
    
    {"message":"The authorization details given appear to be invalid."}
  3. Attempting to access a resource that is not callable will result in a 403 Forbidden response.

    HTTP/1.1 403 Forbidden
    Content-Length: 55
    
    {"message":"The requested resource is not accessible."}
  4. Attempting to access a resource that does not exist will result in a 404 Not Found response.

    HTTP/1.1 404 Not Found
    Content-Length: 52
    
    {"message":"The requested resource does not exist."}
  5. Requesting a format that is not supported will result in a 415 Unsupported Media Type response.

    HTTP/1.1 415 Unsupported Media Type
    Content-Length: 66
    
    {"message":"The format requested is not supported by the server."}
  6. If an unexpected error occurs a 500 Internal Server Error will result. If this error is encountered consult the documentation for the method you are requesting.

    HTTP/1.1 500 Internal Server Error
    Content-Length: 42
    
    {"message":"An unexpected error occured."}
  7. When Blesta is under maintenance mode, the API will return a 503 Service Unavailable response.

    HTTP/1.1 503 Service Unavailable 
    Content-Length: 81 
    
    {"message":"The requested resource is currently unavailable due to maintenance."}

All error response objects contain an array of input parameters that produced errors. From the example above "field" is the parameter name. Each field may contain one or more error codes along with a related message. Common codes are empty, exists, format, length, and valid, but many more are available. The error code is always the index of the error message, and is used primarily in identifying the type of error encountered.

Timestamps

The Reseller API returns all timestamps in UTC time using the following ISO 8601 format:

YYYY-MM-DD hh:mm:ss / 2021-12-31 12:00:00

Methods

Get Credit

Fetch the amount of credit available under your account.

GET https://account.blesta.com/plugin/blesta_reseller/v2/index/getcredit.json
Example Request
{
 "response": 50.25
}

 

Get Packages

Fetches all available reseller packages.

GET https://account.blesta.com/plugin/blesta_reseller/v2/index/getpackages.json
Example Request
{
 "response":[
   {
    "id":"25",
    "name":"Blesta Monthly License",
    "description":"",
    "description_html":"",
    "qty":null,
    "id_code":"25",
    "pricing":[
     {
      "id":"49",
      "term":"1",
      "period":"month",
      "price":"13.0000",
      "setup_fee":"0.0000",
      "cancel_fee":"0.0000",
      "currency":"USD"
     }
    ]
   },
   {
    "id":"26",
    "name":"Blesta Owned License",
    "description":"",
    "description_html":"",
    "qty":null,
    "id_code":"26",
    "pricing":[
     {
      "id":"32",
      "term":"0",
      "period":"onetime",
      "price":"95.0000",
      "setup_fee":"0.0000",
      "cancel_fee":"0.0000",
      "currency":"USD"
     }
    ]
   }
 ]
}

 

Get Package Pricing

Fetches pricing for a specific package.

GET https://account.blesta.com/plugin/blesta_reseller/v2/index/getpackagepricing.json
Example Request
{
 "response":[
  {
   "id":"49",
   "term":"1",
   "period":"month",
   "price":"13.0000",
   "setup_fee":"0.0000",
   "cancel_fee":"0.0000",
   "currency":"USD"
  }
 ]
}

 

Add License

Adds a new license.

POST https://account.blesta.com/plugin/blesta_reseller/v2/index/addlicense.json
Example Request
{
 "response":"abcdef0123456789"
}

Cancel License

Cancels a license.

POST https://account.blesta.com/plugin/blesta_reseller/v2/index/cancellicense.json
Example Request

 

Suspend License

Suspends a license.

POST https://account.blesta.com/plugin/blesta_reseller/v2/index/suspendlicense.json
Example Request

 

Unsuspend License

Unsuspends a license.

POST https://account.blesta.com/plugin/blesta_reseller/v2/index/unsuspendlicense.json
Example Request

 

Update License

Updates a license to set it into a reissue state.

POST https://account.blesta.com/plugin/blesta_reseller/v2/index/update.json
Example Request

 

Returns all licenses that match the search criteria, which includes license key, domain, IP, and install path. Only non-canceled licenses are returned. Up to 25 results are returned for each response. To fetch additional results, increment the vars[page] parameter.

GET https://account.blesta.com/plugin/blesta_reseller/v2/index/search.json
Example Request
{
 "response":[{
  "status":"suspended",
  "date_added":"2012-11-03 17:57:03",
  "date_renews":null,
  "date_suspended":"2013-08-17 17:00:03",
  "date_canceled":null,
  "pricing_id":"32",
  "term":"0",
  "period":"onetime",
  "fields":{
   "license_module_callhome":"",
   "license_module_domains":[
    "domain1.com",
    "domain2.com"
   ],
   "license_module_ips":[
    "192.168.0.1",
    "192.168.0.2"
   ],
   "license_module_key":"abcdef0123456789",
   "license_module_paths":[
    "\/var\/www\/public_html\/"
   ],
   "license_module_status":"",
   "license_module_version":""
  }
 }]
}
  • No labels