Difference between revisions of "Softsale HTTP API"

From aMember Pro Documentation
Jump to: navigation, search
(Created page with "= Softsale HTTP API = In PHP applications we recommend to use the ''softsale-sample-app'' as we described above. To use Softsale from applications in other programming languag...")
 
Line 8: Line 8:
 
== Check-License ==
 
== Check-License ==
 
'''URL''' ''http://www.example.com/amember/softsale/api/check-license''
 
'''URL''' ''http://www.example.com/amember/softsale/api/check-license''
 +
 
'''Input Parameters:'''
 
'''Input Parameters:'''
;key
+
{| border="1" cellspacing="0" cellpadding=3
:license key entered by customer
+
| key
 +
| License key entered by customer
 +
|}
  
'''Positive Response (returned in JSON format)'''
+
'''Positive Response - if license check is passed (returned in JSON format)'''
 
{| border="1" cellspacing="0" cellpadding=3
 
{| border="1" cellspacing="0" cellpadding=3
 
| code
 
| code
Line 34: Line 37:
  
  
'''Negative Response (returned in JSON format)'''
+
'''Negative Response - if license check is failed (returned in JSON format)'''
 
{| border="1" cellspacing="0" cellpadding=3
 
{| border="1" cellspacing="0" cellpadding=3
 
|code
 
|code
Line 75: Line 78:
 
{| border="1" cellspacing="0" cellpadding=3
 
{| border="1" cellspacing="0" cellpadding=3
 
|code
 
|code
|described below in [#HTTP API Error Codes]
+
|described below in [[#Error Codes]]
 
|-
 
|-
 
|message
 
|message
Line 83: Line 86:
 
|seconds to check license next time (if necessary for your licensing/activation logic)
 
|seconds to check license next time (if necessary for your licensing/activation logic)
 
|}
 
|}
 +
 +
== Error Codes ==
 +
In case of failure SoftSale API will return error code in the ''code'' field. In the following table you may find description of error codes.
 +
 +
{| border="1" cellspacing="0" cellpadding=3
 +
| ok
 +
| Operation finished successfully
 +
|-
 +
| license_empty
 +
| Empty or invalid license key submitted
 +
|-
 +
| license_not_found
 +
| License key not found on licensing server
 +
|-
 +
| license_disabled
 +
| License key has been disabled
 +
|-
 +
| license_expired
 +
|
 +
|-
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
 +
 +
    const LICENSE_EMPTY = 'license_empty';
 +
    const LICENSE_NOT_FOUND = 'license_not_found';
 +
    const LICENSE_DISABLED = 'license_disabled';
 +
    const LICENSE_EXPIRED = 'license_expired';
 +
    const LICENSE_SERVER_ERROR = 'license_server_error';
 +
    // activation/deactivation problem codes
 +
    const ACTIVATION_SERVER_ERROR = 'activation_server_error';
 +
    const ERROR_INVALID_INPUT = 'invalid_input';
 +
    const ERROR_NO_SPARE_ACTIVATIONS = 'no_spare_activations';
 +
    const ERROR_NO_ACTIVATION_FOUND = 'no_activation_found';
 +
    const ERROR_NO_REACTIVATION_ALLOWED = 'no_reactivation_allowed';
 +
    const ERROR_NO_RESPONSE = 'no_response';
 +
    const ERROR_OTHER = 'other_error';
 +
 +
    public $messages = array(
 +
        self::OK => 'License OK',
 +
        self::CONNECTION_ERROR => 'Could not connect to licensing server - please try again later',
 +
        self::LICENSE_EMPTY => 'Empty or invalid license key submitted',
 +
        self::LICENSE_NOT_FOUND => 'License key not found on licensing server',
 +
        self::LICENSE_DISABLED => 'License key has been disabled',
 +
        self::LICENSE_EXPIRED => 'License key expired',
 +
        self::LICENSE_SERVER_ERROR => 'License server is not available - please try again later',
 +
        self::ACTIVATION_SERVER_ERROR => 'Activation server error',
 +
        self::ERROR_INVALID_INPUT => 'Activation failed: invalid input',
 +
        self::ERROR_NO_SPARE_ACTIVATIONS => 'No more activations allowed',
 +
        self::ERROR_NO_ACTIVATION_FOUND => 'No activation found for this installation',
 +
        self::ERROR_NO_REACTIVATION_ALLOWED => 'Re-activation is not allowed',
 +
        self::ERROR_NO_RESPONSE => 'Internal problem on activation server',
 +
        self::ERROR_OTHER => 'Error returned from activation server',
 +
    );

Revision as of 16:49, 24 March 2014

Contents

Softsale HTTP API

In PHP applications we recommend to use the softsale-sample-app as we described above. To use Softsale from applications in other programming languages, you may use HTTP API directly to check/activate and de-activate license keys.

How to access the HTTP API

To access API, you need to make HTTP POST call to URL http://www.example.com/amember/softsale/api/ACTION (replace www.example.com/amember with path to your aMember installation and ACTION to the API method) Required parameter for all calls is ``key`` - license key entered by customers (and stored in your software settings locally).

Check-License

URL http://www.example.com/amember/softsale/api/check-license

Input Parameters:

key License key entered by customer

Positive Response - if license check is passed (returned in JSON format)

code ok
message OK
scheme_id Licensing scheme#
scheme_title Licensing scheme title
license_expires license expiration in yyyy-mm-dd hh:ii:ss format
next_check seconds to check license next time (if necessary for your licensing/activation logic)


Negative Response - if license check is failed (returned in JSON format)

code described below in [#HTTP API Error Codes]
message corresponds to the error code
next_check seconds to check license next time (if necessary for your licensing/activation logic)

Activate License

URL http://www.example.com/amember/softsale/api/activate

Positive Response (returned in JSON format)

code ok
message OK
scheme_id Licensing scheme#
scheme_title Licensing scheme title
license_expires license expiration in yyyy-mm-dd hh:ii:ss format
next_check seconds to check license next time (if necessary for your licensing/activation logic)


Negative Response (returned in JSON format)

code described below in #Error Codes
message corresponds to the error code
next_check seconds to check license next time (if necessary for your licensing/activation logic)

Error Codes

In case of failure SoftSale API will return error code in the code field. In the following table you may find description of error codes.

ok Operation finished successfully
license_empty Empty or invalid license key submitted
license_not_found License key not found on licensing server
license_disabled License key has been disabled
license_expired


   const LICENSE_EMPTY = 'license_empty';
   const LICENSE_NOT_FOUND = 'license_not_found';
   const LICENSE_DISABLED = 'license_disabled';
   const LICENSE_EXPIRED = 'license_expired';
   const LICENSE_SERVER_ERROR = 'license_server_error';
   // activation/deactivation problem codes
   const ACTIVATION_SERVER_ERROR = 'activation_server_error';
   const ERROR_INVALID_INPUT = 'invalid_input';
   const ERROR_NO_SPARE_ACTIVATIONS = 'no_spare_activations';
   const ERROR_NO_ACTIVATION_FOUND = 'no_activation_found';
   const ERROR_NO_REACTIVATION_ALLOWED = 'no_reactivation_allowed';
   const ERROR_NO_RESPONSE = 'no_response';
   const ERROR_OTHER = 'other_error';
   public $messages = array(
       self::OK => 'License OK',
       self::CONNECTION_ERROR => 'Could not connect to licensing server - please try again later',
       self::LICENSE_EMPTY => 'Empty or invalid license key submitted',
       self::LICENSE_NOT_FOUND => 'License key not found on licensing server',
       self::LICENSE_DISABLED => 'License key has been disabled',
       self::LICENSE_EXPIRED => 'License key expired',
       self::LICENSE_SERVER_ERROR => 'License server is not available - please try again later',
       self::ACTIVATION_SERVER_ERROR => 'Activation server error',
       self::ERROR_INVALID_INPUT => 'Activation failed: invalid input',
       self::ERROR_NO_SPARE_ACTIVATIONS => 'No more activations allowed',
       self::ERROR_NO_ACTIVATION_FOUND => 'No activation found for this installation',
       self::ERROR_NO_REACTIVATION_ALLOWED => 'Re-activation is not allowed',
       self::ERROR_NO_RESPONSE => 'Internal problem on activation server',
       self::ERROR_OTHER => 'Error returned from activation server',
   );