1. Home
  2. Protected: API Documentation
  3. API Libraries Usage

API Libraries Usage

Get the API libraries files from your affiliation manager and use them as below:

C#

Prerequisites

Add reference to Hexagon.Affiliate.SDK.dll

Request

Request using special Registration request class:

 RegistrationRequest request = new RegistrationRequest()
           {
               Origin = Origin,
           APIEndpoint = APIEndpoint //”api.[brand].com”
               RegistrationInfo = new RegistrationInfo()
               {
                   RegistrationType = "Full",
                     Email = Email,
                   FisrtName = FirstName,
                   LastName = Lastname,
              Password = Password,
                   PhoneNumber = PhoneNumber,
                   CountryCode = CountryCode,
                   OperationalComment = OperationalComment,
                   Deeplink = Deeplink 
               },
               MarketingInfo = new MarketingInfo()
               {
                   AdServer = AdServer,
                   UtmCampaign = UtmCampaign,
                   UtmContent = UtmContent
               },
               Context = new RegistrationContext()
               {
                   ApiKey = APIKey,
                   ApiSecret = APISecret,
                   Locale = Locale,
                   UserAgent = UserAgent 

               }
           };

Response

        result.Status – Error or Success
        
        Success:
            result.RegistrationToken 
            result.Onelink 
        Error:
            result.ErrorCode
            result.ErrorMessage
PHP
$hexagonApi = new HexagonApi('https://api.[brand].com/http/v1', ['apikey' => 'q123', 'apisecret' => 'e123'], 'en-GB', 'HexagonApi PHP Client v0.1');

$hexagonApi->setMarketingData([
"adServer" => "myAdServer",
"utmCampaign" => "myUtmCampaign",
"utmContent" => "myUtmContent"
]);

$hexagonApi->registration->registerUser([
"registrationType" => "Full",
"email" => "qwdqwd@qwdqwd.com",
"firstName" => "FirstName",
"lastName" => "LastName",
"password" => "123456",
"telephone" => "123123",
"countryCode" => "US",
"operComment" => "some comment",
"deeplink" => "some deeplink"
]); 
Java
public class RegistrationRequestTest {
    public void executeRegistration() {
        RegistrationRequest registrationRequest =  Registration.RegisterUserRequest("",
            "yOHrJ13nSqVMZeCFbrCYrstIiBHjse7Z",
            "55cuxiqpAC",
            "en-US",
            "som11e878454611@user.com",
            "John",
            "Smith",
            "1356734568901",
            "UN",
            "test",
            "111",
            "222",
            "382",
            "someUserAgent",
           "Oper comment",
           "Deeplink");
        try {
            RegistrationResponse response = registrationRequest.Execute();
            Assert.assertTrue(response.IsSuccess());
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
}

 
 
Javascript
const Hexagon = require('./hexagon');

const api = new Hexagon.Api({
    hostname: 'api.[brand].com',
    userAgent: 'Chrome',
    locale: 'en-GB',
    apiKey: '<ApiKey>',
    apiSecret: '<ApiSecret>'
});

api
    .registerUser(
        new Hexagon.RegistrationInfo({
            registrationType: Hexagon.REGISTRATION_TYPE.FULL,
            email: 'test180323@2015.com',
            password: '123456',
            firstName: 'John',
            lastName: 'Smith',
            telephone: '+12345 1234567',
            operComment: 'some comment',
            deeplink: 'some deeplink'
        }),
        new Hexagon.MarketingInfo({
            adServer: '<AdServer>',
            utmCampaign: '<UtmCampaign>',
            utmContent: '<UtmContent>'
        })
    )
    .then((result=> {
        /*  console.log('OK:', result);
    
        result: {
            "userId":"4A383131-7E7A-66D4-E050-CB0A146B2563", 
            "user":null ,
            "registrationToken": "HTwNQsuleApraKVNmoi5",
            "onelink": "https://..."
        }
    */
    })
    .catch((error=> {
        /*console.log('ERROR:', error);
        error: {
            "code": "",
            "message": ""
        }
    
    */
    });