Search

MachPanel Knowledgebase

FAQ: MachPanel API

MachPanel


Frequently Asked Questions (FAQ's):

       1.       Where can I find documentation about MachPanel API?

Following links refer to the required information:

 

       2.       What does “Database error” mean?

Database Error is generic database error, usually occurs when MachPanel is unable to find records in database, it may occur because of invalid customer credentials.  In future version of API we will update generic error messages and include specific error message as per the scenario.

 

       3.       Where can I find detailed information about returned errors?

In current version of the API, some of the error codes returned are specified through “ResponseCodes” and possible error codes are presented in the Documentation under “ResponseCodes” type. More detailed error codes with their definitions will be added in upcoming versions of the API.

 

       4.       First request to API takes around 20 seconds disregard of called method. After that all requests take around 5 seconds. Is it normal?

Yes it is normal; whenever a client application first time connects to the API it takes more time than subsequent requests.

 

       5.       I couldn’t find any API object related to billing, payment profiles and credit cards.

At this stage payment profiles and credit cards handling is not implemented, we will add payment processing using API in next version.

 

       6.       Can I use any technology other than .Net to implement the client application for MachPanel API?

Yes you can use any other technology also. For example if you are using PHP and JAVA to implement client application for MachPanel API then you can find some help on following links.

 

       7.       Can I modify the test API application?

API test application is not meant to be restricted as it is, it can be modified by the provider themselves and can be used to pick code snippet(s) to create other applications like a test application.

 

       8.       What are the read only properties in MachPanel API?

Below is the list of read only properties:

 1. CompanySettings

IsBillingOn

SendBillingInvoiceEmail

IsProrateBillingEnabled

                IsTaxCollectionEnabled

                IsWebHostingEnabled

                IsOnlineHelpEnabled

                IsSSLEnabled

                IsDNSEnabled

                IsDomainHostingEnabled

                IsMiscProductEnabled

                IsDedicatedHostingEnabled

                IsExchangeExtensionEnabled

                IsSharepointExtensionEnabled

                IsCrmExtensionEnabled

                IsLyncExtensionEnabled

                IsWirelessExtensionEnabled

                IsVpsExtensionEnabled

                PayByCheque

                PayByDraft

                BillingCPAddress

                HelpManualLink

                CompanyId

                DayOfMonthToBill

                NextInvoiceId

                PayByChequeText

                PayByDraftText

                PaymentGroups

 2. PaymentGroups

                CurrencyId

                CurrencySymbol

                CurrencyTitle

                PaymentGroupId

                PaymentGroupName

 3. HostingPlan

                PlanId

                PlanName

                IsActive

                IsProrated

                AssociateDomain

                PlanPaymentGroups

                PlanServers

                PlanLocales

 4. ServerInfo

                ServerId

                ServerName

 5. LocaleInfo

                LocaleId

                LocaleName

                LocaleCode

6. BillingCycle

                CycleId

                CycleName

                SetupPrice

                Price

                PercentageDiscount

                PaymentGroupId

 7. ResponseArguments

                EventRequested

                ResponseCode

                ResponseMessage

                ResponseStatus

                AssociatedKey

 8. TaxationSettings

                CustomerTaxable

                CompanyTaxDisabled

                IsTax2Compound

                IsActive

                TaxMethod

                Tax2Method

                TaxRate

                Tax2Rate

                TaxTitle

                Tax2Title

 

      9.       Where can I get example code for creating a new customer from MachPanel API?

Example code for creating a new customer can be find at MachPanel API/Forms/UserControls/CustomerRegistration.ascx.cs file. Also the code is shown below:

Code Snippet


01. Customer c = new Customer();

 02. c.Address1 = TxBx_Address.Text.Trim(); 

 03. c.Address2 = TxBx_Address2.Text.Trim();

 04. c.City = TxBx_City.Text.Trim(); 

 05. c.CustomerNumber = TxBx_CustomerNo.Text.Trim();

 06. c.DateCreated = DateTime.Today; 

 07. c.Fax = TxBx_Fax.Text.Trim();

 08. c.FirstName = TxBx_FirstName.Text.Trim(); 

 09. c.IsTaxable = true;

 10. c.LastName = TxBx_LastName.Text.Trim(); 

 11. c.Mobile = TxBx_Mobile.Text.Trim();

 12. c.PassportLogin = TxBx_LoginEmail.Text.Trim(); 

 13. c.PassportPassword = TxBx_LoginPassword.Text.Trim();

 14. c.Phone = TxBx_Phone.Text.Trim(); 

 15. c.PhoneCountryCode = TxBx_CountryCode.Text.Trim();

 16. c.PrimaryEmail = TxBx_LoginEmail.Text.Trim(); 

 16. c.Province = TxBx_Province.Text.Trim();

 17. c.ResellerId = 0; 

 18. c.SecondaryEmail = TxBx_SEmail.Text.Trim();

 19. c.Zip = TxBx_Zip.Text.Trim(); 

 20. c.Country = new CountryInfo();

 21. c.Country.CountryId = int.Parse(DDL_Country.SelectedValue); 

 22. c.State = new StateInfo();

 23. c.State.StateId = int.Parse(String.IsNullOrEmpty(DDL_State.SelectedValue) ? "0" : DDL_State.SelectedValue); 

 24. c.LocaleId = int.Parse(DDL_Locale.SelectedValue);

 25. MachPanelService svc = new MachPanelService(); 

 26. svc.Url = ConfigurationManager.AppSettings["ServiceUrl"];

 27. svc.MPAuthenticationHeaderValue = MPHeader; 

 28. ResponseArguments Args = svc.CreateCustomer(c);

 29. if (Args.ResponseStatus) 

 30. {

 31.     CustomerCreatedEventArgs cce = new CustomerCreatedEventArgs(); 

 32.     cce.CustomerId = int.Parse(Args.AssociatedKey);

 33.     cce.CustomerFirstName = c.FirstName; 

 34.     cce.CustomerLastName = c.LastName;

 35.     cce.CustomerLogin = c.PassportLogin; 

 36.     CustomerSigned(sender, cce);

 37. } 

 38. else

 39. { 

 40. }

<

<







































































In the above code snippet
Customer,ResponseArguments, CountryInfo and StateInfo are proxy classes exposed through the API.

      10.   Can I get a working test example for subscribing exchange hosting using MachPanel API?

Following is a working example of subscribing to an exchange hosting using bulk subscription functionality of MachPanel API.

Code Snippet


1.//if you want to associate addons to a subscription then include line 3-8 otherwise exclude these and assign values accordingly.

2.//Create List of AddOns to Associate for example take single addon. for java, use vectors in place of List<> 

3.List<AddOnSubscription> associatedAddOns = new List<AddOnSubscription>();          

4.AddOnSubscription newaddon = new AddOnSubscription();

5.newaddon.AddOnCycleId = CycleId;//Billing cycle id for AddOn 

6.newaddon.AddOnId = AddOnId;//Selected AddOn Id

7.ewaddon.AddOnQuantity = Quantity;//Quantity for an Addon

8.associatedAddOns.Add(newaddon);  

9.//Create Object of ExchangeHosting class exposed through proxy classes

10.ExchangeHosting eh = new ExchangeHosting(); 

11.eh.OU = new OrganizationalUnit();

12.eh.OU.OrganizationName = OUName;//Name of the Organization as string 

13.//Link addons to the hosting service if there is one

15.eh.AssociatedAddOns = associatedAddOns.ToArray(); 

16.eh.Comments=Comments;//any comments to associate

17.eh.CustomerId=CustomerId;//CustomerId to sell service to

18.eh.CycleId = CycleId;//Billing cycle id for subscription service

19.eh.DomainName = DomainName;//domain name to associate with this organization

20.eh.HasAddOns = true;//if has addons then set to true otherwise set to false

21.eh.HostingTypeId = HostingTypeId; //16 in case of Exchange unique identifier of service/hosting/package types

22.eh.PackageId = PackageId;//selected package/plan Id

23.eh.PaymentGroupId = PaymentGroupId;//selected payment group identifier

24.eh.SignUpDate = DateTime.Today;//Order date

25.//Create service request header and assign credentials 

26.MPAuthenticationHeader MPHeader = new MPAuthenticationHeader();

27.MPHeader.UserName = System.Configuration.ConfigurationManager.AppSettings["CompanyLogin"];// Login for API 

28.MPHeader.UserPassword = System.Configuration.ConfigurationManager.AppSettings["CompanyPassword"]; // Password for API  

29.//Create Service Object 

30.MachPanelService svc = new MachPanelService();

31.svc.Url = ServiceUrl; 

32.svc.MPAuthenticationHeaderValue = MPHeader;      

33.//Add ExchangeHosting object to services [used for bulk subscription]

34.ServiceHostingBase[] services = new ServiceHostingBase[]{ eh };  

35.//Send request to subscribe in bulk.

36.ResponseArguments [] responses = svc.SubscribeMultiple(services, CustomerId PaymentGroupId, true);






<
<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 





































11. Can i get a code to list All/Filtered existing subscriptions of the customers using MachPanel?

Following is a code snippet to List all/filtered existing subscriptions of the customers.

Code Snippet

private void FillSubscriptions() 

    {

        MachPanelService svc = new MachPanelService(); 

        svc.Url = ServiceUrl;

        svc.MPAuthenticationHeaderValue = MPHeader; 

        SubscriptionInfo[] subsList = svc.GetAllSubscriptions();

        Lv_Subscriptions.DataSource = subsList; 

        Lv_Subscriptions.DataBind();

     } 

    //SubscriptionCriteria is a type to get filter criteria from client application

    //Assign values to the members/properties by which you want to filter the subscription records 

    //and leave others unassigned.

    private void FillFilteredSubscriptions(MPService.SubscriptionCriteria SC) 

    {

        MachPanelService svc = new MachPanelService(); 

        svc.Url = ServiceUrl;

        svc.MPAuthenticationHeaderValue = MPHeader; 

        SubscriptionInfo[] subsList = svc.GetSubscriptionsByCriteria(SC);

        Lv_Subscriptions.DataSource = subsList; 

        Lv_Subscriptions.DataBind();

     } 

    //you can call above functions in your client application as

    //SubscriptionCriteria SC = new SubscriptionCriteria(); 

    //SC.PackageTypeId = 16;

    //FillFilteredSubscriptions(SC); OR 

    //FillSubscriptions();

<
<














































12. Can i get code to Cancel/Suspend/Resume an existing subscription of a customer in MachPanel?

Following is a code snippet to Cancel/Suspend/Resume an existing subscription of a customer

Code Snippet


MachPanelService MPSvc = new MachPanelService();

       MPSvc.MPAuthenticationHeaderValue = MPHeader; 

ResponseArguments Args = null;

       ServiceActions action = new ServiceActions(); 

string Comments = string.Empty;

       //Select action as any of the following             

//action = ServiceActions.Cancel;Comments = "Cancel subscription via API";

       //OR                     

//action = ServiceActions.Suspend; Comments = "Suspend subscription via API";

       //OR                     

//action = ServiceActions.Resume; Comments = "Resume subscription via API";

       Args = MPSvc.UpdateSubscriptionStatus(HostingId, HostingTypeId, action, Comments, false);


<
<








Details
Type: FAQ
Level: Beginner
Last Modified: 4 Years Ago
Last Modified By: Zeeshan Masood
Rated 5 stars based on 2 votes.
Article has been viewed 27K times.
Options
Also In This Category
Tags