APIService

This is the connector API's integration point with our API service and is responsible for request encoding, command execution and interpreting the response provided by our servers.

Constructor

The constructor requires two parameters, an application id and a service endpoint.

The application id is a unique token that identifiers the calling application. The details of this token vary depending on the authentication protocol being used - Internal/Reseller requests must provide the application API key, whereas OpenApp requests must provide a valid private key. Please see the authentication guide for more details on authentication protocols.

The service endpoint is the URL of the execution environment that will service requests.

  • Live service endpoint = http://api.majestic.com/api_command.
  • Development service endpoint = http://developer.majestic.com/api_command.

Executing Internal/Reseller requests

This is done by calling the executeCommand method which takes 2 parameters - the command name and a set of command parameters - and returns a Response.

There is also a method overload that takes an additional parameter, the request timeout, which by default is 5 seconds.

Executing OpenApp requests

This is done by calling the executeOpenAppRequest method which takes 3 parameters - the command name, a set of command parameters and the user's access token - and returns a Response.

There is an overload for this method too that takes a timeout which, again by default, is 5 seconds.